@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,1072 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lokalny `git status` per sesja — źródło eventu `git-status` (branch, liczba brudnych plików,
|
|
3
|
+
* ich rodzaje i szczegóły per plik z licznikami linii).
|
|
4
|
+
*
|
|
5
|
+
* Reguły z architektury:
|
|
6
|
+
* - wyłącznie lokalne `git status --porcelain=v2 --branch --untracked-files=all` (+ `git log -1`
|
|
7
|
+
* i ograniczone do listy plików `git diff --numstat`), NIGDY `git fetch` (zero ruchu sieciowego
|
|
8
|
+
* i zero kosztu w tle),
|
|
9
|
+
* - odpalane po domkniętym tool-callu modyfikującym pliki + throttle (żeby seria edycji nie
|
|
10
|
+
* uruchomiła gita dziesięć razy pod rząd),
|
|
11
|
+
* - w trybie demo NIEUŻYWANE — mock-driver emituje `git-status` sam, bez dotykania dysku.
|
|
12
|
+
*
|
|
13
|
+
* Throttle jest „leading edge": pierwsze pytanie w oknie odpala gita, kolejne dostają `null`
|
|
14
|
+
* (wołający nic nie rozgłasza). Świeży odczyt przyjdzie z następnym tool-callem — nie budujemy
|
|
15
|
+
* timera z trailing edge, bo event `git-status` jest kosmetyczny, a nie transakcyjny.
|
|
16
|
+
*/
|
|
17
|
+
import { spawn } from 'node:child_process';
|
|
18
|
+
import { lstat, readlink, realpath } from 'node:fs/promises';
|
|
19
|
+
import { dirname, join, sep } from 'node:path';
|
|
20
|
+
import { MAX_DIFF_PATCH_BYTES } from '@rarog/shared';
|
|
21
|
+
import { CONFIG_NAMES_ENCODING, CONFIG_NAMES_READ_CAP_BYTES, filterDriverNames, withFilterDriversOff, } from './git-config-guard.js';
|
|
22
|
+
import { SANDBOX_EXEC, gitSandboxLogLine, probeGitSandbox } from './git-sandbox.js';
|
|
23
|
+
import { gitWorkTree } from './git-work-tree.js';
|
|
24
|
+
export const DEFAULT_THROTTLE_MS = 3_000;
|
|
25
|
+
export const DEFAULT_MAX_FILES = 50;
|
|
26
|
+
export const DEFAULT_TIMEOUT_MS = 5_000;
|
|
27
|
+
/** Etykieta gałęzi dla HEAD w stanie detached (porcelain v2 zwraca dosłownie `(detached)`). */
|
|
28
|
+
export const DETACHED_BRANCH = '(detached)';
|
|
29
|
+
/**
|
|
30
|
+
* `# branch.ab +2 -1` → 2 commity przed upstreamem, 1 za nim.
|
|
31
|
+
*
|
|
32
|
+
* Git wypisuje ten nagłówek TYLKO gdy gałąź ma upstream, więc jego brak jest informacją
|
|
33
|
+
* („nie ma z czym porównywać"), a nie zerem.
|
|
34
|
+
*/
|
|
35
|
+
const BRANCH_AB = /^# branch\.ab \+(\d+) -(\d+)$/;
|
|
36
|
+
/**
|
|
37
|
+
* Rodzaj brudnego wpisu z pola `XY` porcelain v2.
|
|
38
|
+
*
|
|
39
|
+
* Bierzemy OBIE litery (indeks i drzewo robocze), bo interesuje nas, co się z plikiem stało,
|
|
40
|
+
* a nie w którym obszarze: `AM` (dodany, potem jeszcze zmieniony) to dla nagłówka nowy plik,
|
|
41
|
+
* `.D` (skasowany w drzewie) — usunięty. Usunięcie wygrywa z dodaniem, bo `AD` (dodany do
|
|
42
|
+
* indeksu i skasowany z dysku) kończy się BRAKIEM pliku — a nagłówek ma mówić o stanie,
|
|
43
|
+
* nie o drodze. Wszystko inne (modyfikacja, rename, typechange) to `modified`.
|
|
44
|
+
*/
|
|
45
|
+
function classifyKind(xy) {
|
|
46
|
+
if (xy.includes('D'))
|
|
47
|
+
return 'deleted';
|
|
48
|
+
if (xy.includes('A'))
|
|
49
|
+
return 'added';
|
|
50
|
+
return 'modified';
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Pole `XY` wiersza porcelain v2 — drugie pole, zawsze dwie litery.
|
|
54
|
+
*
|
|
55
|
+
* Czytamy je po spacjach, a nie przez `slice(2, 4)`, bo ta druga forma milczy, gdy wiersz jest
|
|
56
|
+
* krótszy, niż się wydaje (ucięte wyjście gita).
|
|
57
|
+
*/
|
|
58
|
+
function statusField(line) {
|
|
59
|
+
const start = line.indexOf(' ');
|
|
60
|
+
if (start === -1)
|
|
61
|
+
return '';
|
|
62
|
+
const end = line.indexOf(' ', start + 1);
|
|
63
|
+
return end === -1 ? line.slice(start + 1) : line.slice(start + 1, end);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Parsuje wyjście `git status --porcelain=v2 --branch`.
|
|
67
|
+
*
|
|
68
|
+
* Liczymy wpisy: `1` (zmiana zwykła), `2` (rename/copy), `u` (konflikt), `?` (nieśledzony).
|
|
69
|
+
* Wpisy `!` (ignorowane) NIE liczą się jako brudne — inaczej każdy `node_modules` zawyżałby licznik.
|
|
70
|
+
*
|
|
71
|
+
* Ten sam przebieg rozbija brudne pliki na trójkę `fileKinds` (dodane / zmienione / usunięte):
|
|
72
|
+
* nieśledzony (`?`) to dodany, konflikt (`u`) to zmieniony, a dla `1`/`2` decyduje pole `XY`
|
|
73
|
+
* (patrz {@link classifyKind}). Suma trójki jest równa `dirtyCount` z definicji. Ta sama
|
|
74
|
+
* klasyfikacja daje `kind` każdego wpisu `fileDetails` — liczniki linii dokłada dopiero watcher.
|
|
75
|
+
*
|
|
76
|
+
* @param maxFiles ile nazw plików zwracamy do UI (reszta jest pomijana — karta i tak nie pokaże)
|
|
77
|
+
*/
|
|
78
|
+
export function parseGitStatusV2(stdout, maxFiles = DEFAULT_MAX_FILES) {
|
|
79
|
+
return parsePorcelain(stdout, maxFiles).status;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Status i ścieżki, o które warto zapytać `git diff --numstat` — jeden przebieg parsera.
|
|
83
|
+
*
|
|
84
|
+
* `pathspecs` to wpisy ŚLEDZONE z listy (≤ `maxFiles`): `1`, `u` i `2` razem ze ścieżką ŹRÓDŁOWĄ
|
|
85
|
+
* rename'u (bez niej git liczy nowy plik jako dodany w całości — zmierzone na git 2.54:
|
|
86
|
+
* `diff --numstat HEAD -- new.ts` daje `9 0`, z `old.ts` w pathspecu `2 1`). Bez liczników
|
|
87
|
+
* zostają: nieśledzone (`?` — `git diff HEAD` ich nie pokazuje) i wpisy, których którejkolwiek
|
|
88
|
+
* ścieżki nie da się dopasować ({@link unmatchable}). Rename liczy się w CAŁOŚCI albo wcale:
|
|
89
|
+
* cel bez źródła to znów „cały plik dodany", czyli liczby, które kłamią.
|
|
90
|
+
*/
|
|
91
|
+
export function parsePorcelain(stdout, maxFiles = DEFAULT_MAX_FILES) {
|
|
92
|
+
let branch = DETACHED_BRANCH;
|
|
93
|
+
let dirtyCount = 0;
|
|
94
|
+
const files = [];
|
|
95
|
+
const fileDetails = [];
|
|
96
|
+
const pathspecs = [];
|
|
97
|
+
const fileKinds = { added: 0, modified: 0, deleted: 0 };
|
|
98
|
+
let ahead;
|
|
99
|
+
let behind;
|
|
100
|
+
for (const line of stdout.split('\n')) {
|
|
101
|
+
if (line === '')
|
|
102
|
+
continue;
|
|
103
|
+
if (line.startsWith('# branch.head ')) {
|
|
104
|
+
branch = line.slice('# branch.head '.length).trim();
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
if (line.startsWith('# branch.ab ')) {
|
|
108
|
+
const match = BRANCH_AB.exec(line.trimEnd());
|
|
109
|
+
if (match !== null) {
|
|
110
|
+
ahead = Number(match[1]);
|
|
111
|
+
behind = Number(match[2]);
|
|
112
|
+
}
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
if (line.startsWith('#'))
|
|
116
|
+
continue;
|
|
117
|
+
const kind = line[0];
|
|
118
|
+
if (kind !== '1' && kind !== '2' && kind !== 'u' && kind !== '?')
|
|
119
|
+
continue;
|
|
120
|
+
dirtyCount += 1;
|
|
121
|
+
const detailKind = kind === '?'
|
|
122
|
+
? 'added'
|
|
123
|
+
: (kind === 'u' ? 'modified' : classifyKind(statusField(line)));
|
|
124
|
+
fileKinds[detailKind] += 1;
|
|
125
|
+
const path = extractPath(kind, line);
|
|
126
|
+
if (path === null || files.length >= maxFiles)
|
|
127
|
+
continue;
|
|
128
|
+
files.push(path);
|
|
129
|
+
fileDetails.push({ path, kind: detailKind });
|
|
130
|
+
if (kind === '?')
|
|
131
|
+
continue;
|
|
132
|
+
const origin = kind === '2' ? renameOrigin(line) : null;
|
|
133
|
+
const entry = origin === null ? [path] : [path, origin];
|
|
134
|
+
if (entry.some(unmatchable))
|
|
135
|
+
continue;
|
|
136
|
+
pathspecs.push(...entry);
|
|
137
|
+
}
|
|
138
|
+
const status = { branch, dirtyCount, files, fileKinds, fileDetails };
|
|
139
|
+
// Pola dokładamy tylko, gdy upstream istnieje — `undefined` w JSON-ie eventu to szum.
|
|
140
|
+
if (ahead !== undefined)
|
|
141
|
+
status.ahead = ahead;
|
|
142
|
+
if (behind !== undefined)
|
|
143
|
+
status.behind = behind;
|
|
144
|
+
return { status, pathspecs };
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Ścieżki statusu, której `numstat` nie odda w tej samej postaci:
|
|
148
|
+
* - CYTOWANA (`"za\305\274…"`, `core.quotePath`) — `-z` oddaje surowe bajty;
|
|
149
|
+
* - spoza katalogu sesji (`../top.txt`, sesja w podkatalogu repo) — `numstat --relative` takich
|
|
150
|
+
* plików nie pokazuje wcale, a rename przez tę granicę liczyłby cel jako dodany w całości.
|
|
151
|
+
*/
|
|
152
|
+
function unmatchable(path) {
|
|
153
|
+
return path.startsWith('"') || path.startsWith('../');
|
|
154
|
+
}
|
|
155
|
+
/** Ścieżka ŹRÓDŁOWA rename'u (`2 … <path>\t<orig>`) albo `null`, gdy wiersz jej nie niesie. */
|
|
156
|
+
function renameOrigin(line) {
|
|
157
|
+
const tab = line.indexOf('\t');
|
|
158
|
+
if (tab === -1)
|
|
159
|
+
return null;
|
|
160
|
+
const origin = line.slice(tab + 1).trim();
|
|
161
|
+
return origin === '' ? null : origin;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Wyciąga ścieżkę z wiersza porcelain v2.
|
|
165
|
+
*
|
|
166
|
+
* Układ pól (bez `-z`, więc separatorem jest spacja, a rename oddziela TAB):
|
|
167
|
+
* - `? <path>`
|
|
168
|
+
* - `1 <XY> <sub> <mH> <mI> <mW> <hH> <hI> <path>` → ścieżka to pole 9.
|
|
169
|
+
* - `2 <XY> <sub> <mH> <mI> <mW> <hH> <hI> <X score> <path>\t<orig>` → ścieżka to pole 10.
|
|
170
|
+
* - `u <XY> <sub> <m1> <m2> <m3> <mW> <h1> <h2> <h3> <path>` → ścieżka to pole 11.
|
|
171
|
+
*/
|
|
172
|
+
function extractPath(kind, line) {
|
|
173
|
+
if (kind === '?')
|
|
174
|
+
return line.slice(2).trim() || null;
|
|
175
|
+
const fieldsBeforePath = kind === '1' ? 8 : kind === '2' ? 9 : 10;
|
|
176
|
+
let index = 0;
|
|
177
|
+
for (let field = 0; field < fieldsBeforePath; field += 1) {
|
|
178
|
+
const space = line.indexOf(' ', index);
|
|
179
|
+
if (space === -1)
|
|
180
|
+
return null;
|
|
181
|
+
index = space + 1;
|
|
182
|
+
}
|
|
183
|
+
const rest = line.slice(index);
|
|
184
|
+
// Przy rename ścieżka nowa i stara są rozdzielone tabulatorem — bierzemy nową.
|
|
185
|
+
const tab = rest.indexOf('\t');
|
|
186
|
+
const path = (tab === -1 ? rest : rest.slice(0, tab)).trim();
|
|
187
|
+
return path === '' ? null : path;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Górna granica tego, ile bajtów w ogóle CZYTAMY z gita.
|
|
191
|
+
*
|
|
192
|
+
* Patch idzie do klienta ucięty do 512 kB, ale sam `git diff HEAD` w brudnym repo potrafi
|
|
193
|
+
* mieć dziesiątki MB — po przekroczeniu tego progu zabijamy proces i pracujemy na tym, co
|
|
194
|
+
* już mamy (i tak wystarcza z ogromnym zapasem na 512 kB).
|
|
195
|
+
*/
|
|
196
|
+
export const DIFF_READ_CAP_BYTES = 8 * 1024 * 1024;
|
|
197
|
+
/** Opcje globalne dozwolone w {@link GitCommand.global} — ta sama lista co typ, do kontroli w biegu. */
|
|
198
|
+
const GIT_GLOBAL_OPTIONS = ['--literal-pathspecs'];
|
|
199
|
+
/**
|
|
200
|
+
* Podkomendy, które serwer uruchamia. Lista ZAMKNIĘTA: napis w tym miejscu
|
|
201
|
+
* git czyta jeszcze jako opcję globalną, więc „podkomenda” `-c` z `rest` = `['core.fsmonitor=…', …]` stałaby
|
|
202
|
+
* po osłonach i je nadpisała. Wbudowanych podkomend nie zasłoni też alias z konfiguracji repo.
|
|
203
|
+
*/
|
|
204
|
+
export const GIT_SUBCOMMANDS = ['status', 'log', 'diff', 'ls-files', 'rev-parse'];
|
|
205
|
+
/**
|
|
206
|
+
* The two options that pin a git process to the repository of a read:
|
|
207
|
+
*
|
|
208
|
+
* - `--work-tree=<T>`: git puts it over `core.worktree` from repository config, which the agent writes, so that key
|
|
209
|
+
* cannot move a read outside `T`;
|
|
210
|
+
* - `--git-dir=<T>/.git`: git does not look for a repository itself. A `.git` entry it would not take for one (an
|
|
211
|
+
* empty directory, a dangling symlink) then ends the read, where discovery would skip the entry, take the
|
|
212
|
+
* repository above and lay its index over `T`, handing out committed files from outside the session directory.
|
|
213
|
+
*/
|
|
214
|
+
function repositoryPin(workTree) {
|
|
215
|
+
return [`--git-dir=${join(workTree, '.git')}`, `--work-tree=${workTree}`];
|
|
216
|
+
}
|
|
217
|
+
/** Fixed argv of each runner probe, after the config guards. */
|
|
218
|
+
const PROBE_ARGV = {
|
|
219
|
+
version: ['version'],
|
|
220
|
+
'exec-path': ['--exec-path'],
|
|
221
|
+
'config-names': ['config', '--null', '--name-only', '--list'],
|
|
222
|
+
};
|
|
223
|
+
/**
|
|
224
|
+
* Guards of EVERY git process Rarog starts: repository config, which the agent writes from its sandbox, runs
|
|
225
|
+
* no program on a read. Rarog's git runs outside that sandbox.
|
|
226
|
+
*
|
|
227
|
+
* - `core.fsmonitor=false`: the hook from `core.fsmonitor` ran on `status`, `diff` and `ls-files`;
|
|
228
|
+
* - `log.showSignature=false`: with `true` in repo config `git log` verified the commit signature with the program
|
|
229
|
+
* from `gpg.program` (measured on git 2.54: `core.fsmonitor=false` alone does not stop it);
|
|
230
|
+
* - `safe.bareRepository=explicit`: a directory with `HEAD`, `objects` and `refs` inside the project (say, with
|
|
231
|
+
* `core.worktree` and a filter in its `config`) is not taken as a repository. Git honours this key only from
|
|
232
|
+
* protected config, and the command line counts as protected;
|
|
233
|
+
* - `core.hooksPath=/dev/null`: no hook runs, neither from `.git/hooks` nor from a `core.hooksPath` of the repo;
|
|
234
|
+
* - `diff.submodule=short`: the `log` and `diff` formats read a submodule's history or diff it under its own config.
|
|
235
|
+
*
|
|
236
|
+
* Flags per subcommand: {@link subcommandGuards}; environment: {@link GIT_ENV_GUARDS}. `-c` options reach git's child
|
|
237
|
+
* processes (submodules) through `GIT_CONFIG_PARAMETERS`. Filter drivers (`clean`, `process`), which git runs when it
|
|
238
|
+
* hashes a changed working-tree file on `status` and `diff`, are emptied per process: {@link filterDriversOff}.
|
|
239
|
+
*/
|
|
240
|
+
export const GIT_CONFIG_GUARDS = [
|
|
241
|
+
'-c', 'core.fsmonitor=false', '-c', 'log.showSignature=false', '-c', 'safe.bareRepository=explicit',
|
|
242
|
+
'-c', 'core.hooksPath=/dev/null', '-c', 'diff.submodule=short',
|
|
243
|
+
];
|
|
244
|
+
/** Flaga każdego `git diff` Raroga: patch bez programu z `diff.<drv>.textconv`. */
|
|
245
|
+
export const NO_TEXTCONV = '--no-textconv';
|
|
246
|
+
/**
|
|
247
|
+
* `status` and `diff` do not look inside a submodule's working tree: the dirty check runs `git status` in the
|
|
248
|
+
* submodule, under the submodule's own config and filters. A submodule whose only change is in its working
|
|
249
|
+
* tree therefore does not show; a new commit checked out in it still does.
|
|
250
|
+
*/
|
|
251
|
+
const IGNORE_DIRTY_SUBMODULES = '--ignore-submodules=dirty';
|
|
252
|
+
/**
|
|
253
|
+
* Flags right after the subcommand, before the caller's arguments: `diff` gets `--no-textconv`
|
|
254
|
+
* (`diff.<drv>.textconv` ran a program on a patch), `--no-ext-diff` (`diff.external` replaced the patch with
|
|
255
|
+
* a program's output) and {@link IGNORE_DIRTY_SUBMODULES}; `log` gets `--no-ext-diff`; `status` gets
|
|
256
|
+
* {@link IGNORE_DIRTY_SUBMODULES}. A function, not a table: `NO_EXT_DIFF` is declared further down.
|
|
257
|
+
*/
|
|
258
|
+
function subcommandGuards(sub) {
|
|
259
|
+
switch (sub) {
|
|
260
|
+
case 'diff': return [NO_TEXTCONV, NO_EXT_DIFF, IGNORE_DIRTY_SUBMODULES];
|
|
261
|
+
case 'log': return [NO_EXT_DIFF];
|
|
262
|
+
case 'status': return [IGNORE_DIRTY_SUBMODULES];
|
|
263
|
+
default: return [];
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Full argv of a git process: the guards, the repository pin of a command the runner bound ({@link BoundGitCommand},
|
|
268
|
+
* {@link repositoryPin}), the global options, the subcommand, its guards ({@link subcommandGuards}) and the rest.
|
|
269
|
+
* A runner probe ({@link GitRunnerProbe}) gets the guards and its fixed argv; the config names read of a read carries
|
|
270
|
+
* the pin of that read, the version and exec path probes read no repository and carry none.
|
|
271
|
+
*/
|
|
272
|
+
export function gitArgv(command) {
|
|
273
|
+
if ('probe' in command) {
|
|
274
|
+
if (!Object.hasOwn(PROBE_ARGV, command.probe)) {
|
|
275
|
+
throw new TypeError(`git: probe outside the list: ${JSON.stringify(command.probe)}`);
|
|
276
|
+
}
|
|
277
|
+
const pin = 'workTree' in command && command.probe === 'config-names' ? repositoryPin(command.workTree) : [];
|
|
278
|
+
return [...GIT_CONFIG_GUARDS, ...pin, ...PROBE_ARGV[command.probe]];
|
|
279
|
+
}
|
|
280
|
+
/*
|
|
281
|
+
* Kontrola w biegu obok typów: atrapa, rzutowanie albo dane spoza TypeScriptu nie przejdą. Rzuca — runner łapie
|
|
282
|
+
* to jak nieudany start procesu (`spawnFailed`), więc git z takim argv nie startuje.
|
|
283
|
+
*/
|
|
284
|
+
if (!GIT_SUBCOMMANDS.includes(command.sub)) {
|
|
285
|
+
throw new TypeError(`git: podkomenda spoza listy: ${JSON.stringify(command.sub)}`);
|
|
286
|
+
}
|
|
287
|
+
for (const option of command.global ?? []) {
|
|
288
|
+
if (!GIT_GLOBAL_OPTIONS.includes(option)) {
|
|
289
|
+
throw new TypeError(`git: opcja globalna spoza listy: ${JSON.stringify(option)}`);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
const pin = 'workTree' in command ? repositoryPin(command.workTree) : [];
|
|
293
|
+
return [
|
|
294
|
+
...GIT_CONFIG_GUARDS, ...pin, ...(command.global ?? []), command.sub, ...subcommandGuards(command.sub),
|
|
295
|
+
...command.rest,
|
|
296
|
+
];
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Environment guards of every git process. The runner sets them last, over the server's `GIT_*` passthrough:
|
|
300
|
+
*
|
|
301
|
+
* - `GIT_NO_LAZY_FETCH=1`: a repository with a missing object and a promisor remote does not fetch the object when
|
|
302
|
+
* `diff` needs it. The fetch runs a program from repo config (`remote.<name>.uploadpack`, the transport of an
|
|
303
|
+
* `ext::` URL). Git honours the variable from {@link MIN_GIT_VERSION};
|
|
304
|
+
* - `GIT_ALLOW_PROTOCOL=` (empty): no transport is allowed, so an `ext::` URL runs nothing even with
|
|
305
|
+
* `protocol.ext.allow=always` in repo config. `-c protocol.allow=never` would not do: repo config overrides it per
|
|
306
|
+
* protocol.
|
|
307
|
+
*/
|
|
308
|
+
const GIT_ENV_GUARDS = { GIT_NO_LAZY_FETCH: '1', GIT_ALLOW_PROTOCOL: '' };
|
|
309
|
+
/**
|
|
310
|
+
* Variables of the server's `GIT_*` passthrough that no git process of the runner gets. The first two would
|
|
311
|
+
* leave a filter driver on, the third would choose the program:
|
|
312
|
+
*
|
|
313
|
+
* - `GIT_CONFIG` moves only `git config` to another file, so the config names read would list a config that
|
|
314
|
+
* `status` and `diff` do not use, and a driver of the repository would stay unlisted;
|
|
315
|
+
* - `GIT_CONFIG_PARAMETERS` (the `-c` pairs of a parent git) wins over the `GIT_CONFIG_COUNT` pairs the runner
|
|
316
|
+
* empties the drivers with;
|
|
317
|
+
* - `GIT_EXEC_PATH` names the directory git takes its own programs from. The sandbox starts the `git` of that directory
|
|
318
|
+
* ({@link gitSandbox}), so a directory an agent can write would hand it the program of every read.
|
|
319
|
+
*/
|
|
320
|
+
const GIT_ENV_DROPPED = new Set(['GIT_CONFIG', 'GIT_CONFIG_PARAMETERS', 'GIT_EXEC_PATH']);
|
|
321
|
+
/** `env` as every git process of the runner gets it: without {@link GIT_ENV_DROPPED}, with {@link GIT_ENV_GUARDS}. */
|
|
322
|
+
function guardedGitEnv(env) {
|
|
323
|
+
const kept = Object.entries(env).filter(([name]) => !GIT_ENV_DROPPED.has(name));
|
|
324
|
+
return { ...Object.fromEntries(kept), ...GIT_ENV_GUARDS };
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Oldest git the runner starts `diff` with: `GIT_NO_LAZY_FETCH` works from git 2.44. With an older git `diff` is
|
|
328
|
+
* refused, because a lazy fetch was measured on `diff` only; `status`, `log`, `ls-files` and `rev-parse` still run.
|
|
329
|
+
*/
|
|
330
|
+
const MIN_GIT_VERSION = { major: 2, minor: 44 };
|
|
331
|
+
/** Read cap of `git version` and `git --exec-path` (one line each). */
|
|
332
|
+
const VERSION_READ_CAP_BYTES = 4 * 1024;
|
|
333
|
+
/** `git version 2.54.0 (Apple Git-157)` → 2 and 54. */
|
|
334
|
+
const GIT_VERSION_LINE = /^git version (\d+)\.(\d+)/;
|
|
335
|
+
/** `true` when `git version` output names a git at or above {@link MIN_GIT_VERSION}; anything else is `false`. */
|
|
336
|
+
function supportsNoLazyFetch(stdout) {
|
|
337
|
+
const match = GIT_VERSION_LINE.exec(stdout);
|
|
338
|
+
if (match === null)
|
|
339
|
+
return false;
|
|
340
|
+
const major = Number(match[1]);
|
|
341
|
+
const minor = Number(match[2]);
|
|
342
|
+
return major > MIN_GIT_VERSION.major || (major === MIN_GIT_VERSION.major && minor >= MIN_GIT_VERSION.minor);
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Version checks per `PATH`, which decides the `git` binary the runner starts. An answer (old enough or not) is kept
|
|
346
|
+
* for the life of the process; a failed read (timeout, failed start, exit code ≠ 0) is dropped, so the next `diff`
|
|
347
|
+
* asks again. Concurrent diffs share one read.
|
|
348
|
+
*/
|
|
349
|
+
const versionChecks = new Map();
|
|
350
|
+
/**
|
|
351
|
+
* `null` when `diff` may run, otherwise the result the refused `diff` returns. The refusal carries no `exitCode`:
|
|
352
|
+
* git did not answer the diff, so callers report a failure, not "nothing to compare". A failed version read passes
|
|
353
|
+
* on `timedOut` and `spawnFailed`.
|
|
354
|
+
*/
|
|
355
|
+
function diffRefusal(env, timeoutMs, sandbox) {
|
|
356
|
+
const key = env['PATH'] ?? '';
|
|
357
|
+
const known = versionChecks.get(key);
|
|
358
|
+
if (known !== undefined)
|
|
359
|
+
return known;
|
|
360
|
+
// `/` as cwd: `git version` reads no repository, and no repository config is near.
|
|
361
|
+
const check = startGit({ probe: 'version' }, '/', env, timeoutMs, VERSION_READ_CAP_BYTES, 'utf8', sandbox).then((result) => {
|
|
362
|
+
if (!result.ok) {
|
|
363
|
+
versionChecks.delete(key);
|
|
364
|
+
return refusalAfter(result);
|
|
365
|
+
}
|
|
366
|
+
return supportsNoLazyFetch(result.stdout) ? null : { ok: false, stdout: '' };
|
|
367
|
+
});
|
|
368
|
+
versionChecks.set(key, check);
|
|
369
|
+
return check;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* The result of a read the runner refuses after its own probe failed: no `exitCode` (git did not answer the read, so
|
|
373
|
+
* callers report a failure, not "nothing to compare"), but `timedOut` and `spawnFailed` of the probe pass on.
|
|
374
|
+
*/
|
|
375
|
+
function refusalAfter(probe) {
|
|
376
|
+
return {
|
|
377
|
+
ok: false, stdout: '',
|
|
378
|
+
...(probe.timedOut === true ? { timedOut: true } : {}),
|
|
379
|
+
...(probe.spawnFailed === undefined ? {} : { spawnFailed: probe.spawnFailed }),
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* The environment of one git process with every filter driver of its config emptied, or the refused read.
|
|
384
|
+
* The names are read in the same `cwd`, with the same guards, environment and repository pin (`workTree`) as the
|
|
385
|
+
* process itself, so git lists the same config files (repository, worktree, includes, global, system, pairs from the
|
|
386
|
+
* environment). The read is
|
|
387
|
+
* refused, and git does not start, when the names read fails, times out or reaches its cap, when a driver name is not
|
|
388
|
+
* UTF-8, or when the environment's own pair count is not plain digits ({@link withFilterDriversOff}). A driver added
|
|
389
|
+
* between the names read and the start of git stays on for that process: turning the drivers off does not close this
|
|
390
|
+
* race, the sandbox does ({@link gitSandbox}).
|
|
391
|
+
*/
|
|
392
|
+
async function filterDriversOff(cwd, workTree, env, timeoutMs, sandbox) {
|
|
393
|
+
const listing = await startGit({ probe: 'config-names', workTree }, cwd, env, timeoutMs, CONFIG_NAMES_READ_CAP_BYTES, CONFIG_NAMES_ENCODING, sandbox);
|
|
394
|
+
if (!listing.ok || listing.capped === true)
|
|
395
|
+
return { refused: refusalAfter(listing) };
|
|
396
|
+
const names = filterDriverNames(Buffer.from(listing.stdout, CONFIG_NAMES_ENCODING));
|
|
397
|
+
const cleared = names === null ? null : withFilterDriversOff(env, names);
|
|
398
|
+
return cleared === null ? { refused: { ok: false, stdout: '' } } : { env: cleared };
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Środowisko procesu gita CZYTAJĄCEGO repo (`status`, `diff`, `ls-files`).
|
|
402
|
+
*
|
|
403
|
+
* Baza jest PODAWANA (`gitEnvBase` z konfiguracji), nigdy ze środowiska serwera — granica
|
|
404
|
+
* sekretów to `GIT_ENV_PASSTHROUGH` w `config-env.ts`. Dokładamy stałe: te odczyty są w 100%
|
|
405
|
+
* lokalne, więc `GIT_SSH_COMMAND` byłoby tu szumem, ale `git diff` w repo z submodułami
|
|
406
|
+
* potrafi dotknąć konfiguracji z promptem.
|
|
407
|
+
*/
|
|
408
|
+
export function gitReadEnv(base) {
|
|
409
|
+
/*
|
|
410
|
+
* `GIT_OPTIONAL_LOCKS=0`: `git status` domyślnie ODŚWIEŻA indeks (zapisuje `.git/index`),
|
|
411
|
+
* gdy stat plików się rozjechał. Na `.git` siedzi watcher (`git-watch.ts`),
|
|
412
|
+
* który po każdej zmianie pyta gita jeszcze raz — nasz własny odczyt nie ma prawa być
|
|
413
|
+
* zdarzeniem, na które sam reaguje. To dokładnie ten przełącznik, który git daje
|
|
414
|
+
* narzędziom działającym w tle (edytory, prompt powłoki).
|
|
415
|
+
*/
|
|
416
|
+
return { ...base, GIT_TERMINAL_PROMPT: '0', GIT_OPTIONAL_LOCKS: '0', ...GIT_ENV_GUARDS };
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* Wspólny spawn gita z twardym timeoutem — zero interaktywności, zero stdin, zero sieci.
|
|
420
|
+
*
|
|
421
|
+
* @param env pełne środowisko procesu (`gitReadEnv(config.gitEnvBase)`). WYMAGANE: wartość
|
|
422
|
+
* domyślna oznaczałaby ciche dziedziczenie env serwera razem z sekretami Raroga.
|
|
423
|
+
* @param maxBytes po przekroczeniu limitu proces jest zabijany, a wynik oznaczany jako OK
|
|
424
|
+
* z `capped: true`: wołający chce prefiks, nie całość (patrz `DIFF_READ_CAP_BYTES`).
|
|
425
|
+
*
|
|
426
|
+
* Nie rzuca: proces, którego nie dało się uruchomić, wraca jako `ok: false` z kodem errno
|
|
427
|
+
* w `spawnFailed` — także wtedy, gdy Node zgłasza błąd `spawn` synchronicznie (ENOMEM i inne
|
|
428
|
+
* spoza jego krótkiej listy błędów „na później").
|
|
429
|
+
*
|
|
430
|
+
* The runner puts {@link GIT_ENV_GUARDS} over `env` itself and takes {@link GIT_ENV_DROPPED} out of it, so a caller's
|
|
431
|
+
* environment cannot undo either, and starts
|
|
432
|
+
* `diff` only with a git at or above {@link MIN_GIT_VERSION} (version read once per `PATH`). Before every git
|
|
433
|
+
* process it reads the config key names and empties each filter driver ({@link filterDriversOff}); that read and the
|
|
434
|
+
* process share `timeoutMs`. On macOS every one of these git processes starts under the sandbox
|
|
435
|
+
* ({@link gitSandbox}, probed once per environment). Before anything else it binds the command to the work tree of the
|
|
436
|
+
* read ({@link bindWorkTree}); a read without one starts no git at all.
|
|
437
|
+
*/
|
|
438
|
+
export function spawnGitArgs(env, timeoutMs = DEFAULT_TIMEOUT_MS, maxBytes = DIFF_READ_CAP_BYTES) {
|
|
439
|
+
const processEnv = guardedGitEnv(env);
|
|
440
|
+
return async (command, cwd) => {
|
|
441
|
+
const bound = await bindWorkTree(command, cwd);
|
|
442
|
+
if ('refused' in bound)
|
|
443
|
+
return bound.refused;
|
|
444
|
+
const layer2 = await gitSandbox(processEnv);
|
|
445
|
+
const sandbox = 'sandbox' in layer2 ? layer2.sandbox : null;
|
|
446
|
+
if (bound.command.sub === 'diff') {
|
|
447
|
+
const refusal = await diffRefusal(processEnv, timeoutMs, sandbox);
|
|
448
|
+
if (refusal !== null)
|
|
449
|
+
return refusal;
|
|
450
|
+
}
|
|
451
|
+
const deadline = Date.now() + timeoutMs;
|
|
452
|
+
const drivers = await filterDriversOff(cwd, bound.command.workTree, processEnv, timeoutMs, sandbox);
|
|
453
|
+
if ('refused' in drivers)
|
|
454
|
+
return drivers.refused;
|
|
455
|
+
return startGit(bound.command, cwd, drivers.env, Math.max(1, deadline - Date.now()), maxBytes, 'utf8', sandbox);
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* `command` bound to the work tree of a read in `cwd`, or the result of a read that starts no git:
|
|
460
|
+
* - no directory up from `cwd` has `.git`: exit code 128, what git answers outside a repository. Git does not run,
|
|
461
|
+
* because a `.git` created between the lookup and its start would come with its own `core.worktree`;
|
|
462
|
+
* - `cwd` cannot be resolved, or the command is not one the runner takes ({@link gitArgv} throws): `spawnFailed`,
|
|
463
|
+
* as for a process that did not start.
|
|
464
|
+
* The config names read ({@link filterDriversOff}) runs in the same `cwd` with the same pin.
|
|
465
|
+
*/
|
|
466
|
+
async function bindWorkTree(command, cwd) {
|
|
467
|
+
try {
|
|
468
|
+
const workTree = await gitWorkTree(cwd);
|
|
469
|
+
if (workTree === null)
|
|
470
|
+
return { refused: { ok: false, stdout: '', exitCode: 128 } };
|
|
471
|
+
// Built field by field: a `workTree` or a `probe` in the caller's object does not reach the argv.
|
|
472
|
+
const bound = { global: command.global, sub: command.sub, rest: command.rest, workTree };
|
|
473
|
+
gitArgv(bound);
|
|
474
|
+
return { command: bound };
|
|
475
|
+
}
|
|
476
|
+
catch (error) {
|
|
477
|
+
return { refused: { ok: false, stdout: '', spawnFailed: errnoCode(error) } };
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* The sandbox probe runs per `PATH`, which decides the git binaries. One probe per environment for the life of the
|
|
482
|
+
* process: its answer, also "not applied", stays. Concurrent reads share one probe.
|
|
483
|
+
*/
|
|
484
|
+
const sandboxProbes = new Map();
|
|
485
|
+
/**
|
|
486
|
+
* The sandbox for the git processes of `env`: the sandbox every one of them starts under, or why git runs with the
|
|
487
|
+
* filter drivers off only (not macOS, no git on `PATH`, a profile `sandbox-exec` cannot apply, measured under another
|
|
488
|
+
* sandbox). `git --exec-path` of the probe runs without the sandbox: it reads no repository. The first probe of an
|
|
489
|
+
* environment decides; `sandboxExec` is the program it tries.
|
|
490
|
+
*/
|
|
491
|
+
export function gitSandbox(env, sandboxExec = SANDBOX_EXEC) {
|
|
492
|
+
const processEnv = guardedGitEnv(env);
|
|
493
|
+
const key = processEnv['PATH'] ?? '';
|
|
494
|
+
const known = sandboxProbes.get(key);
|
|
495
|
+
if (known !== undefined)
|
|
496
|
+
return known;
|
|
497
|
+
const run = (probe, sandbox) => startGit(probe, '/', processEnv, DEFAULT_TIMEOUT_MS, VERSION_READ_CAP_BYTES, 'utf8', sandbox);
|
|
498
|
+
const probe = probeGitSandbox(process.platform, processEnv['PATH'] ?? '', sandboxExec, {
|
|
499
|
+
execPath: () => run({ probe: 'exec-path' }, null),
|
|
500
|
+
version: (sandbox) => run({ probe: 'version' }, sandbox),
|
|
501
|
+
}).catch((error) => ({ unavailable: `probe failed: ${errnoCode(error)}` }));
|
|
502
|
+
sandboxProbes.set(key, probe);
|
|
503
|
+
return probe;
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Server start: probes the sandbox once for the environment of the server's git reads and writes one log line when
|
|
507
|
+
* git runs with the filter drivers off only.
|
|
508
|
+
*/
|
|
509
|
+
export async function probeGitSandboxAtStart(env, log, sandboxExec = SANDBOX_EXEC) {
|
|
510
|
+
const state = await gitSandbox(env, sandboxExec);
|
|
511
|
+
if ('unavailable' in state)
|
|
512
|
+
log(gitSandboxLogLine(state.unavailable));
|
|
513
|
+
return state;
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* One git process: the only `spawn` of git in the server. Contract of the result: {@link spawnGitArgs}.
|
|
517
|
+
* `encoding` decodes stdout; the names read uses {@link CONFIG_NAMES_ENCODING} to keep the bytes. With `sandbox` git
|
|
518
|
+
* starts through `sandbox-exec` ({@link gitSandbox}), with the same argv after the profile and the binary.
|
|
519
|
+
* A caller's command comes only bound to its work tree ({@link BoundGitCommand}).
|
|
520
|
+
*/
|
|
521
|
+
function startGit(command, cwd, env, timeoutMs, maxBytes, encoding, sandbox) {
|
|
522
|
+
return new Promise((resolve) => {
|
|
523
|
+
let child;
|
|
524
|
+
// Nie chcemy, żeby git próbował pytać o cokolwiek interaktywnie ani czytać stdin.
|
|
525
|
+
const options = { cwd, stdio: ['ignore', 'pipe', 'ignore'], env };
|
|
526
|
+
try {
|
|
527
|
+
child = sandbox === null
|
|
528
|
+
? spawn('git', gitArgv(command), options)
|
|
529
|
+
: spawn(sandbox.file, [...sandbox.args, ...gitArgv(command)], options);
|
|
530
|
+
}
|
|
531
|
+
catch (error) {
|
|
532
|
+
resolve({ ok: false, stdout: '', spawnFailed: errnoCode(error) });
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
let stdout = '';
|
|
536
|
+
let bytes = 0;
|
|
537
|
+
let settled = false;
|
|
538
|
+
const finish = (result) => {
|
|
539
|
+
if (settled)
|
|
540
|
+
return;
|
|
541
|
+
settled = true;
|
|
542
|
+
clearTimeout(timer);
|
|
543
|
+
resolve(result);
|
|
544
|
+
};
|
|
545
|
+
const timer = setTimeout(() => {
|
|
546
|
+
child.kill('SIGKILL');
|
|
547
|
+
// Powód JEST znany — patrz `GitArgsResult.timedOut`.
|
|
548
|
+
finish({ ok: false, stdout, timedOut: true });
|
|
549
|
+
}, timeoutMs);
|
|
550
|
+
// Przy EMFILE/ENFILE Node nie zakłada rur wcale (`stdout === null`) i zaraz zgłosi `error`.
|
|
551
|
+
child.stdout?.setEncoding(encoding);
|
|
552
|
+
child.stdout?.on('data', (chunk) => {
|
|
553
|
+
if (settled)
|
|
554
|
+
return;
|
|
555
|
+
stdout += chunk;
|
|
556
|
+
bytes += Buffer.byteLength(chunk, encoding);
|
|
557
|
+
if (bytes >= maxBytes) {
|
|
558
|
+
child.kill('SIGKILL');
|
|
559
|
+
finish({ ok: true, stdout, capped: true });
|
|
560
|
+
}
|
|
561
|
+
});
|
|
562
|
+
// Procesu nie dało się uruchomić — powód idzie dalej, bo „system nie dał procesu" to inna
|
|
563
|
+
// diagnoza niż „git odpowiedział błędem" (`GitArgsResult.spawnFailed`).
|
|
564
|
+
child.on('error', (error) => { finish({ ok: false, stdout, spawnFailed: errnoCode(error) }); });
|
|
565
|
+
child.on('close', (code) => {
|
|
566
|
+
// Proces zabity sygnałem ma `code === null`: kodu wyjścia nie ma i pole nie powstaje.
|
|
567
|
+
finish(typeof code === 'number' ? { ok: code === 0, stdout, exitCode: code } : { ok: false, stdout });
|
|
568
|
+
});
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
/** Kod errno z błędu `spawn` — `UNKNOWN`, gdy błąd go nie niesie (nie ma czego zgadywać). */
|
|
572
|
+
export function errnoCode(error) {
|
|
573
|
+
const code = error?.code;
|
|
574
|
+
return typeof code === 'string' && code !== '' ? code : 'UNKNOWN';
|
|
575
|
+
}
|
|
576
|
+
/** Wariant związany z jednym poleceniem (status / log). */
|
|
577
|
+
function spawnGit(command, env, timeoutMs) {
|
|
578
|
+
const run = spawnGitArgs(env, timeoutMs);
|
|
579
|
+
return (cwd) => run(command, cwd);
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* Produkcyjny runner statusu: `git status --porcelain=v2 --branch --untracked-files=all`.
|
|
583
|
+
*
|
|
584
|
+
* `--untracked-files=all`: bez niej nowy katalog to jeden wpis `? docs/` i panel nie ma jak pokazać
|
|
585
|
+
* plików w środku. Sufit {@link DEFAULT_MAX_FILES} nie zasłoni przez to zmian śledzonych, bo porcelain
|
|
586
|
+
* v2 wypisuje je przed nieśledzonymi (zmierzone na git 2.54). Zagnieżdżone repo dalej daje
|
|
587
|
+
* jeden wpis z `/` na końcu — git w nie nie schodzi.
|
|
588
|
+
*/
|
|
589
|
+
export function spawnGitStatus(env, timeoutMs = DEFAULT_TIMEOUT_MS) {
|
|
590
|
+
return spawnGit({ sub: 'status', rest: ['--porcelain=v2', '--branch', '--untracked-files=all'] }, env, timeoutMs);
|
|
591
|
+
}
|
|
592
|
+
/** Separator pól w `git log --format` — US (0x1f), bo w temacie commita może stać wszystko. */
|
|
593
|
+
const LOG_SEP = '\u001f';
|
|
594
|
+
/** Format `git log -1`: skrót SHA, temat, czas commitera (epoka w sekundach). */
|
|
595
|
+
export const GIT_LOG_FORMAT = '%h%x1f%s%x1f%ct';
|
|
596
|
+
/**
|
|
597
|
+
* `git log -1 --format=%h%x1f%s%x1f%ct` → ostatni commit albo `null`.
|
|
598
|
+
*
|
|
599
|
+
* `null` dla pustego wyjścia (repo bez commitów) i dla śmieci (zły separator, czas nie jest
|
|
600
|
+
* liczbą) — wolimy nie pokazać wiersza, niż zmyślić commit.
|
|
601
|
+
*/
|
|
602
|
+
export function parseGitLog(stdout) {
|
|
603
|
+
const line = stdout.split('\n').find((l) => l !== '') ?? '';
|
|
604
|
+
const [hash, subject, ct] = line.split(LOG_SEP);
|
|
605
|
+
if (hash === undefined || hash === '' || subject === undefined || ct === undefined)
|
|
606
|
+
return null;
|
|
607
|
+
const seconds = Number(ct.trim());
|
|
608
|
+
if (!Number.isFinite(seconds))
|
|
609
|
+
return null;
|
|
610
|
+
return { hash, subject, at: new Date(seconds * 1000).toISOString() };
|
|
611
|
+
}
|
|
612
|
+
/** Produkcyjny runner ostatniego commita: `git log -1`. Lokalny jak pozostałe. */
|
|
613
|
+
export function spawnGitLog(env, timeoutMs = DEFAULT_TIMEOUT_MS) {
|
|
614
|
+
return spawnGit({ sub: 'log', rest: ['-1', `--format=${GIT_LOG_FORMAT}`] }, env, timeoutMs);
|
|
615
|
+
}
|
|
616
|
+
// ---------------------------------------------------------------------------
|
|
617
|
+
// Liczniki linii per plik (`fileDetails`) — `git diff --numstat -z` dla listy z `status`
|
|
618
|
+
// ---------------------------------------------------------------------------
|
|
619
|
+
/**
|
|
620
|
+
* Własny budżet odczytu liczników. `numstat` biegnie PO `status` (potrzebuje jego listy plików),
|
|
621
|
+
* więc ta liczba to najdłużej, o ile odczyt liczników opóźnia ramkę `git-status`. Po budżecie
|
|
622
|
+
* proces jest zabijany, a ramka jedzie z samymi rodzajami.
|
|
623
|
+
*/
|
|
624
|
+
export const GIT_NUMSTAT_BUDGET_MS = 1_500;
|
|
625
|
+
/** Sufit wyjścia `numstat`: ≤ 50 plików (i źródła rename'ów) to setki bajtów, nie megabajty. */
|
|
626
|
+
export const GIT_NUMSTAT_READ_CAP_BYTES = 64 * 1024;
|
|
627
|
+
/**
|
|
628
|
+
* Polecenie odczytu liczników dla podanych ścieżek.
|
|
629
|
+
*
|
|
630
|
+
* - `--literal-pathspecs`: ścieżka z pliku to ŚCIEŻKA, nie wzorzec — `*`, `?` i magia `:(…)`
|
|
631
|
+
* w nazwie pliku nie rozszerzają zapytania na pół repo;
|
|
632
|
+
* - `-z`: ścieżka dosłownie (spacja, tabulator, „ => ” w nazwie), a rename jako dwa osobne pola
|
|
633
|
+
* zamiast `stare => nowe`, którego bez `-z` nie da się odróżnić od nazwy z dosłownym „ => ”;
|
|
634
|
+
* - `--relative`: ścieżki względem katalogu sesji, jak w `git status`. Bez niego sesja
|
|
635
|
+
* w podkatalogu repo (`rarog/server`) dostawała `server/src/x.ts` wobec `src/x.ts` w statusie —
|
|
636
|
+
* liczniki chybiały, a przy tej samej nazwie w korzeniu (`../src/x.ts` → `src/x.ts`) trafiały
|
|
637
|
+
* do CUDZEGO pliku (zmierzone na git 2.54);
|
|
638
|
+
* - `--no-ext-diff` jak w diffie sesji (patrz {@link NO_EXT_DIFF}).
|
|
639
|
+
*/
|
|
640
|
+
export function numstatArgs(pathspecs) {
|
|
641
|
+
return {
|
|
642
|
+
global: ['--literal-pathspecs'], sub: 'diff',
|
|
643
|
+
rest: [NO_EXT_DIFF, '--relative', '--numstat', '-z', 'HEAD', '--', ...pathspecs],
|
|
644
|
+
};
|
|
645
|
+
}
|
|
646
|
+
/** Rekord `numstat -z`: `dodane\tusunięte\tścieżka` albo przy rename `dodane\tusunięte\t` + 2 pola. */
|
|
647
|
+
const NUMSTAT_HEAD = /^(\d+|-)\t(\d+|-)\t([\s\S]*)$/;
|
|
648
|
+
/**
|
|
649
|
+
* `git diff --numstat -z` → mapa ścieżka (po zmianie) → liczniki.
|
|
650
|
+
*
|
|
651
|
+
* Bierzemy WYŁĄCZNIE rekordy domknięte bajtem NUL: kawałek po ostatnim NUL to rekord ucięty
|
|
652
|
+
* (sufit bajtów, zabity proces) i jego liczby mogłyby być połówką. Plik binarny (`-\t-`) wraca
|
|
653
|
+
* jako `binary: true` bez liczników — `parseNumstatFiles` diffa sesji dalej zamienia go na 0/0.
|
|
654
|
+
*/
|
|
655
|
+
export function parseNumstatZ(stdout) {
|
|
656
|
+
const out = new Map();
|
|
657
|
+
const fields = stdout.split('\0');
|
|
658
|
+
fields.pop();
|
|
659
|
+
for (let i = 0; i < fields.length; i += 1) {
|
|
660
|
+
const match = NUMSTAT_HEAD.exec(fields[i] ?? '');
|
|
661
|
+
if (match === null)
|
|
662
|
+
continue;
|
|
663
|
+
const [, added = '', deleted = ''] = match;
|
|
664
|
+
let path = match[3] ?? '';
|
|
665
|
+
if (path === '') {
|
|
666
|
+
// Rename/copy: dwa kolejne pola to ścieżka źródłowa i docelowa — liczy się docelowa.
|
|
667
|
+
const target = fields[i + 2];
|
|
668
|
+
if (target === undefined)
|
|
669
|
+
break;
|
|
670
|
+
path = target;
|
|
671
|
+
i += 2;
|
|
672
|
+
}
|
|
673
|
+
if (path === '')
|
|
674
|
+
continue;
|
|
675
|
+
if (added === '-' && deleted === '-')
|
|
676
|
+
out.set(path, { binary: true });
|
|
677
|
+
else if (added !== '-' && deleted !== '-') {
|
|
678
|
+
out.set(path, { linesAdded: Number(added), linesDeleted: Number(deleted) });
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
return out;
|
|
682
|
+
}
|
|
683
|
+
// ---------------------------------------------------------------------------
|
|
684
|
+
// Diff sesji (`GET /api/sessions/:id/diff`)
|
|
685
|
+
// ---------------------------------------------------------------------------
|
|
686
|
+
/**
|
|
687
|
+
* Ścieżka z wiersza `--numstat`.
|
|
688
|
+
*
|
|
689
|
+
* Rename bez `-z` git zapisuje jako `stare => nowe` (czasem z prefiksem/sufiksem wspólnym:
|
|
690
|
+
* `src/{a => b}/plik.ts`). Bierzemy stronę PRAWĄ — overlay pokazuje stan po zmianie.
|
|
691
|
+
*/
|
|
692
|
+
export function numstatPath(raw) {
|
|
693
|
+
const arrow = raw.indexOf(' => ');
|
|
694
|
+
if (arrow === -1)
|
|
695
|
+
return raw;
|
|
696
|
+
const open = raw.indexOf('{');
|
|
697
|
+
const close = raw.indexOf('}');
|
|
698
|
+
if (open !== -1 && close > open) {
|
|
699
|
+
const middle = raw.slice(open + 1, close);
|
|
700
|
+
const to = middle.slice(middle.indexOf(' => ') + 4);
|
|
701
|
+
return `${raw.slice(0, open)}${to}${raw.slice(close + 1)}`;
|
|
702
|
+
}
|
|
703
|
+
return raw.slice(arrow + 4);
|
|
704
|
+
}
|
|
705
|
+
/**
|
|
706
|
+
* `git diff --numstat HEAD` → lista plików z licznikami (diff sesji, bez `-z`).
|
|
707
|
+
*
|
|
708
|
+
* Pliki binarne (`-\t-`) zostają na liście z zerami: użytkownik ma zobaczyć, że plik się
|
|
709
|
+
* zmienił, nawet jeśli nie ma tam linii do policzenia. Ramka `git-status` ma własny parser
|
|
710
|
+
* ({@link parseNumstatZ}), który binarność zachowuje.
|
|
711
|
+
*/
|
|
712
|
+
export function parseNumstatFiles(stdout) {
|
|
713
|
+
const out = [];
|
|
714
|
+
for (const line of stdout.split('\n')) {
|
|
715
|
+
if (line === '')
|
|
716
|
+
continue;
|
|
717
|
+
const parts = line.split('\t');
|
|
718
|
+
if (parts.length < 3)
|
|
719
|
+
continue;
|
|
720
|
+
const added = Number(parts[0]);
|
|
721
|
+
const deleted = Number(parts[1]);
|
|
722
|
+
const path = numstatPath(parts.slice(2).join('\t').trim());
|
|
723
|
+
if (path === '')
|
|
724
|
+
continue;
|
|
725
|
+
out.push({
|
|
726
|
+
path,
|
|
727
|
+
linesAdded: Number.isInteger(added) ? added : 0,
|
|
728
|
+
linesDeleted: Number.isInteger(deleted) ? deleted : 0,
|
|
729
|
+
});
|
|
730
|
+
}
|
|
731
|
+
return out;
|
|
732
|
+
}
|
|
733
|
+
/**
|
|
734
|
+
* `git diff --name-status HEAD` → mapa ścieżka → status.
|
|
735
|
+
*
|
|
736
|
+
* Litery gita mapujemy na trójkę z kontraktu: `R` (rename) to dla overlaya zwykła modyfikacja
|
|
737
|
+
* pliku docelowego, `C` (copy) to nowy plik, reszta (`T`, `U`, `X`) to modyfikacja.
|
|
738
|
+
*/
|
|
739
|
+
export function parseNameStatus(stdout) {
|
|
740
|
+
const map = new Map();
|
|
741
|
+
for (const line of stdout.split('\n')) {
|
|
742
|
+
if (line === '')
|
|
743
|
+
continue;
|
|
744
|
+
const parts = line.split('\t');
|
|
745
|
+
const code = (parts[0] ?? '').trim();
|
|
746
|
+
if (code === '' || parts.length < 2)
|
|
747
|
+
continue;
|
|
748
|
+
// Rename/copy niosą DWIE ścieżki — interesuje nas docelowa (ostatnia).
|
|
749
|
+
const path = (parts.at(-1) ?? '').trim();
|
|
750
|
+
if (path === '')
|
|
751
|
+
continue;
|
|
752
|
+
const letter = code[0];
|
|
753
|
+
const status = letter === 'A' || letter === 'C'
|
|
754
|
+
? 'A'
|
|
755
|
+
: (letter === 'D' ? 'D' : 'M');
|
|
756
|
+
map.set(path, status);
|
|
757
|
+
}
|
|
758
|
+
return map;
|
|
759
|
+
}
|
|
760
|
+
/**
|
|
761
|
+
* Ucina patch do limitu BAJTÓW, na granicy linii.
|
|
762
|
+
*
|
|
763
|
+
* Cięcie po ostatnim `\n` w budżecie robi dwie rzeczy naraz: nie rozjeżdża znaku UTF-8
|
|
764
|
+
* i nie zostawia w overlayu połówki linii diffa (co wyglądałoby jak uszkodzony patch).
|
|
765
|
+
*
|
|
766
|
+
* Najpierw MIERZYMY, a kopiujemy dopiero na ścieżce ucinania: `Buffer.from` na patchu, który
|
|
767
|
+
* i tak się mieści (czyli praktycznie zawsze), to kopia całości po to, żeby poznać jej długość.
|
|
768
|
+
* Zmierzone w Node 22: 400 kB — 0,30 ms wobec 0,11 ms, 8 MB (sufit `DIFF_READ_CAP_BYTES`) —
|
|
769
|
+
* 5,97 ms wobec 2,17 ms i osiem megabajtów alokacji na żądanie.
|
|
770
|
+
*/
|
|
771
|
+
export function clampPatch(patch, maxBytes = MAX_DIFF_PATCH_BYTES) {
|
|
772
|
+
if (Buffer.byteLength(patch, 'utf8') <= maxBytes)
|
|
773
|
+
return { patch, truncated: false };
|
|
774
|
+
const head = Buffer.from(patch, 'utf8').subarray(0, maxBytes);
|
|
775
|
+
const lastNewline = head.lastIndexOf(0x0a);
|
|
776
|
+
const cut = lastNewline > 0 ? head.subarray(0, lastNewline + 1) : head;
|
|
777
|
+
return { patch: cut.toString('utf8'), truncated: true };
|
|
778
|
+
}
|
|
779
|
+
/**
|
|
780
|
+
* Rodzaj wpisu nieśledzonego przez `lstat` — czyli BEZ podążania za dowiązaniem.
|
|
781
|
+
*
|
|
782
|
+
* `git diff --no-index -- /dev/null <ścieżka>` sprawdza ścieżkę przez `stat`: gdy to katalog (albo
|
|
783
|
+
* dowiązanie do katalogu), porównuje `/dev/null` z `<ścieżka>/null`. Nieśledzone dowiązanie do katalogu
|
|
784
|
+
* POZA repo, w którym leży plik `null`, oddałoby więc jego treść (zmierzone na git 2.54).
|
|
785
|
+
* Dlatego do `--no-index` idzie wyłącznie zwykły plik.
|
|
786
|
+
*/
|
|
787
|
+
export async function probeUntracked(cwd, path) {
|
|
788
|
+
try {
|
|
789
|
+
const full = join(cwd, path);
|
|
790
|
+
// Katalog nadrzędny po rozwiązaniu dowiązań ma leżeć w katalogu sesji: `ls-files` nie schodzi
|
|
791
|
+
// w dowiązania, więc katalog podmieniony na dowiązanie PO wypisaniu listy odpada tutaj.
|
|
792
|
+
const [root, parent] = await Promise.all([realpath(cwd), realpath(dirname(full))]);
|
|
793
|
+
if (parent !== root && !parent.startsWith(root + sep))
|
|
794
|
+
return { kind: 'other' };
|
|
795
|
+
const info = await lstat(full);
|
|
796
|
+
if (info.isSymbolicLink())
|
|
797
|
+
return { kind: 'symlink', target: await readlink(full) };
|
|
798
|
+
return info.isFile() ? { kind: 'file' } : { kind: 'other' };
|
|
799
|
+
}
|
|
800
|
+
catch {
|
|
801
|
+
return { kind: 'other' };
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
/**
|
|
805
|
+
* Blok patcha dla nieśledzonego dowiązania, złożony przez serwer: ten sam kształt, który git daje
|
|
806
|
+
* dla dowiązania do pliku (tryb `120000`, jedyną „linią" jest cel). Celu nikt nie otwiera.
|
|
807
|
+
*/
|
|
808
|
+
export function symlinkPatch(path, target) {
|
|
809
|
+
// Cel z nową linią (legalna nazwa pliku) to kilka linii patcha, każda z własnym `+` — bez
|
|
810
|
+
// zamiany znaków, bo dwa różne cele dawałyby wtedy ten sam blok.
|
|
811
|
+
const closed = target.endsWith('\n');
|
|
812
|
+
const lines = (closed ? target.slice(0, -1) : target).split('\n');
|
|
813
|
+
const range = lines.length === 1 ? '+1' : `+1,${String(lines.length)}`;
|
|
814
|
+
const body = lines.map((line) => `+${line}\n`).join('');
|
|
815
|
+
const before = patchHeaderPath('a/', path);
|
|
816
|
+
const after = patchHeaderPath('b/', path);
|
|
817
|
+
return {
|
|
818
|
+
patch: `diff --git ${before} ${after}\nnew file mode 120000\n--- /dev/null\n+++ ${after}\n`
|
|
819
|
+
+ `@@ -0,0 ${range} @@\n${body}${closed ? '' : '\\n'}`,
|
|
820
|
+
lines: lines.length,
|
|
821
|
+
};
|
|
822
|
+
}
|
|
823
|
+
/** Znaki, przez które git bierze ścieżkę nagłówka w cudzysłów: sterujące, `"` i `\`. */
|
|
824
|
+
const HEADER_QUOTED = /[\u0000-\u001f\u007f"\\]/g;
|
|
825
|
+
/**
|
|
826
|
+
* Ścieżka w nagłówku patcha tak, jak pisze ją git: zwykła dosłownie, a z tabulatorem, nową linią,
|
|
827
|
+
* cudzysłowem albo ukośnikiem wstecznym — w cudzysłowie z sekwencjami C (`"b/na\tme"`). Bez tego
|
|
828
|
+
* nazwa z nową linią rozrywała nagłówek na dwie linie i mogła dopisać do bloku własne linie
|
|
829
|
+
* (`git apply --numstat` taki blok odrzuca).
|
|
830
|
+
*/
|
|
831
|
+
function patchHeaderPath(prefix, path) {
|
|
832
|
+
if (path.search(HEADER_QUOTED) === -1)
|
|
833
|
+
return `${prefix}${path}`;
|
|
834
|
+
const escaped = path.replace(HEADER_QUOTED, (char) => {
|
|
835
|
+
switch (char) {
|
|
836
|
+
case '\t': return '\\t';
|
|
837
|
+
case '\n': return '\\n';
|
|
838
|
+
case '\r': return '\\r';
|
|
839
|
+
case '"': return '\\"';
|
|
840
|
+
case '\\': return '\\\\';
|
|
841
|
+
default: return `\\${char.charCodeAt(0).toString(8).padStart(3, '0')}`;
|
|
842
|
+
}
|
|
843
|
+
});
|
|
844
|
+
return `"${prefix}${escaped}"`;
|
|
845
|
+
}
|
|
846
|
+
/**
|
|
847
|
+
* Zbiera diff katalogu sesji: `git diff HEAD` (patch) + `--numstat` (liczby) + `--name-status`
|
|
848
|
+
* (litery A/M/D).
|
|
849
|
+
*
|
|
850
|
+
* Trzy wywołania zamiast jednego, bo git ma JEDEN format wyjścia na raz — a parsowanie
|
|
851
|
+
* statusów z samego patcha byłoby własnym parserem diffa (dokładnie tego spec zabrania po
|
|
852
|
+
* stronie UI i nie ma powodu wprowadzać go po stronie serwera).
|
|
853
|
+
*
|
|
854
|
+
* Wszystkie trzy są lokalne: żadne nie dotyka sieci. Katalog spoza repo (albo repo bez HEAD)
|
|
855
|
+
* = pusty diff, nie błąd — sesja może żyć w katalogu, który nie jest repozytorium.
|
|
856
|
+
*/
|
|
857
|
+
/** Sufit plików NIEŚLEDZONYCH w diffie — każdy to osobny spawn gita. */
|
|
858
|
+
const UNTRACKED_DIFF_CAP = 20;
|
|
859
|
+
/**
|
|
860
|
+
* `--no-ext-diff` przy KAŻDYM `git diff` diffa sesji: `diff.external` z konfiguracji repo
|
|
861
|
+
* podmienia patch na wyjście zewnętrznego programu. Zmierzone na git 2.54 ze skryptem, który
|
|
862
|
+
* nic nie pisze na stdout: 0 B z `diff HEAD` i z `diff --no-index`, czyli overlay „brak zmian"
|
|
863
|
+
* przy realnej zmianie — a program, który coś wypisze, i tak nie odda patcha unified, który
|
|
864
|
+
* umie narysować front. `--numstat`/`--name-status` programu nie wołają, ale flaga stoi i tam,
|
|
865
|
+
* żeby cztery wywołania czytało się jednym wzrokiem. `textconv` wyłącza runner ({@link gitArgv});
|
|
866
|
+
* filtry `clean`/`smudge` zostają.
|
|
867
|
+
*
|
|
868
|
+
* The runner adds this flag to every `diff` and `log` itself ({@link subcommandGuards}); a caller that still passes
|
|
869
|
+
* it only repeats it, and git takes the flag twice without complaint.
|
|
870
|
+
*/
|
|
871
|
+
export const NO_EXT_DIFF = '--no-ext-diff';
|
|
872
|
+
/**
|
|
873
|
+
* `--relative` przy każdym `git diff HEAD` diffa sesji: diff obejmuje WYŁĄCZNIE
|
|
874
|
+
* katalog sesji, a ścieżki są względem niego — jak w ramce `git-status`. Bez tego sesja
|
|
875
|
+
* w podkatalogu repo (`repo/public`, gdy korzeniem Raroga jest tylko on) dostawała patch całego
|
|
876
|
+
* repozytorium, razem z plikami z katalogów obok (`repo/private`), czyli spoza zasięgu.
|
|
877
|
+
*/
|
|
878
|
+
export const RELATIVE = '--relative';
|
|
879
|
+
export async function collectDiff(cwd, opts) {
|
|
880
|
+
const run = opts.run;
|
|
881
|
+
const [patchResult, numstatResult, nameStatusResult, untrackedResult] = await Promise.all([
|
|
882
|
+
run({ sub: 'diff', rest: [NO_EXT_DIFF, RELATIVE, 'HEAD'] }, cwd).catch(() => ({ ok: false, stdout: '' })),
|
|
883
|
+
run({ sub: 'diff', rest: [NO_EXT_DIFF, RELATIVE, '--numstat', 'HEAD'] }, cwd)
|
|
884
|
+
.catch(() => ({ ok: false, stdout: '' })),
|
|
885
|
+
run({ sub: 'diff', rest: [NO_EXT_DIFF, RELATIVE, '--name-status', 'HEAD'] }, cwd)
|
|
886
|
+
.catch(() => ({ ok: false, stdout: '' })),
|
|
887
|
+
// Pliki nieśledzone: `git diff HEAD` ich NIE pokazuje, a `git status` je liczy — bez tej
|
|
888
|
+
// gałęzi overlay mówiłby „0 plików" przy liczniku „1 plik".
|
|
889
|
+
run({ sub: 'ls-files', rest: ['--others', '--exclude-standard'] }, cwd)
|
|
890
|
+
.catch(() => ({ ok: false, stdout: '' })),
|
|
891
|
+
]);
|
|
892
|
+
if (!patchResult.ok && !numstatResult.ok) {
|
|
893
|
+
return { files: [], patch: '', truncated: false };
|
|
894
|
+
}
|
|
895
|
+
const statuses = nameStatusResult.ok ? parseNameStatus(nameStatusResult.stdout) : new Map();
|
|
896
|
+
const files = parseNumstatFiles(numstatResult.ok ? numstatResult.stdout : '')
|
|
897
|
+
.map((file) => ({
|
|
898
|
+
path: file.path,
|
|
899
|
+
// Brak wpisu w `--name-status` (np. gdy to wywołanie padło) — modyfikacja jest
|
|
900
|
+
// najbezpieczniejszym domysłem: nie sugeruje ani utworzenia, ani skasowania pliku.
|
|
901
|
+
status: statuses.get(file.path) ?? 'M',
|
|
902
|
+
linesAdded: file.linesAdded,
|
|
903
|
+
linesDeleted: file.linesDeleted,
|
|
904
|
+
}));
|
|
905
|
+
/*
|
|
906
|
+
* Nieśledzone dokładamy per plik przez `git diff --no-index -- /dev/null <plik>`.
|
|
907
|
+
* Uwaga na kod wyjścia: `--no-index` kończy się 1, gdy pliki się różnią (czyli ZAWSZE tu),
|
|
908
|
+
* więc liczy się stdout, nie `ok`. Sekwencyjnie i z sufitem — to spawn na plik, a katalog
|
|
909
|
+
* świeżego projektu potrafi mieć setki nieśledzonych plików.
|
|
910
|
+
*
|
|
911
|
+
* Do `--no-index` idzie TYLKO zwykły plik ({@link probeUntracked}): dowiązanie dostaje blok
|
|
912
|
+
* złożony przez serwer, a katalog i pliki specjalne są pomijane.
|
|
913
|
+
*/
|
|
914
|
+
const probe = opts.probe ?? probeUntracked;
|
|
915
|
+
const untracked = (untrackedResult.ok ? untrackedResult.stdout : '')
|
|
916
|
+
.split('\n')
|
|
917
|
+
.map((line) => line.trim())
|
|
918
|
+
.filter((line) => line !== '')
|
|
919
|
+
.slice(0, UNTRACKED_DIFF_CAP);
|
|
920
|
+
let untrackedPatch = '';
|
|
921
|
+
for (const path of untracked) {
|
|
922
|
+
const entry = await probe(cwd, path).catch(() => ({ kind: 'other' }));
|
|
923
|
+
if (entry.kind === 'other')
|
|
924
|
+
continue;
|
|
925
|
+
if (entry.kind === 'symlink') {
|
|
926
|
+
const block = symlinkPatch(path, entry.target);
|
|
927
|
+
files.push({ path, status: 'A', linesAdded: block.lines, linesDeleted: 0 });
|
|
928
|
+
untrackedPatch += block.patch;
|
|
929
|
+
continue;
|
|
930
|
+
}
|
|
931
|
+
const result = await run({ sub: 'diff', rest: [NO_EXT_DIFF, '--no-index', '--', '/dev/null', path] }, cwd)
|
|
932
|
+
.catch(() => ({ ok: false, stdout: '' }));
|
|
933
|
+
if (result.stdout === '')
|
|
934
|
+
continue;
|
|
935
|
+
const added = result.stdout
|
|
936
|
+
.split('\n')
|
|
937
|
+
.filter((line) => line.startsWith('+') && !line.startsWith('+++')).length;
|
|
938
|
+
files.push({ path, status: 'A', linesAdded: added, linesDeleted: 0 });
|
|
939
|
+
untrackedPatch += result.stdout.endsWith('\n') ? result.stdout : `${result.stdout}\n`;
|
|
940
|
+
}
|
|
941
|
+
const clamped = clampPatch((patchResult.ok ? patchResult.stdout : '') + untrackedPatch, opts.maxPatchBytes ?? MAX_DIFF_PATCH_BYTES);
|
|
942
|
+
return { files, patch: clamped.patch, truncated: clamped.truncated };
|
|
943
|
+
}
|
|
944
|
+
/**
|
|
945
|
+
* Throttlowany dostawca statusu gita, jeden na serwer (klucz throttle'a to `cwd`).
|
|
946
|
+
*/
|
|
947
|
+
export class GitStatusWatcher {
|
|
948
|
+
#run;
|
|
949
|
+
#runLog;
|
|
950
|
+
#runNumstat;
|
|
951
|
+
#onCollect;
|
|
952
|
+
#throttleMs;
|
|
953
|
+
#maxFiles;
|
|
954
|
+
#now;
|
|
955
|
+
#lastRunAt = new Map();
|
|
956
|
+
#inFlight = new Map();
|
|
957
|
+
/** Jeden ZAPLANOWANY odczyt `force` na katalog — kolejni wymuszający dołączają do niego. */
|
|
958
|
+
#pendingForce = new Map();
|
|
959
|
+
constructor(opts) {
|
|
960
|
+
this.#run = opts.run;
|
|
961
|
+
this.#runLog = opts.runLog ?? null;
|
|
962
|
+
this.#runNumstat = opts.runNumstat ?? null;
|
|
963
|
+
this.#onCollect = opts.onCollect ?? null;
|
|
964
|
+
this.#throttleMs = opts.throttleMs ?? DEFAULT_THROTTLE_MS;
|
|
965
|
+
this.#maxFiles = opts.maxFiles ?? DEFAULT_MAX_FILES;
|
|
966
|
+
this.#now = opts.now ?? (() => Date.now());
|
|
967
|
+
}
|
|
968
|
+
/**
|
|
969
|
+
* Pyta gita o status katalogu.
|
|
970
|
+
*
|
|
971
|
+
* @param force pomija throttle. Używane WYŁĄCZNIE wtedy, gdy repo właśnie się zmieniło
|
|
972
|
+
* (koniec tury, zmiana w `.git` spoza sesji) — stary odczyt kłamałby, więc
|
|
973
|
+
* throttle byłby tu szkodliwy.
|
|
974
|
+
* @returns status albo `null`, gdy zapytanie wpadło w throttle, katalog nie jest repo
|
|
975
|
+
* albo git zwrócił błąd.
|
|
976
|
+
*/
|
|
977
|
+
async status(cwd, force = false) {
|
|
978
|
+
const running = this.#inFlight.get(cwd);
|
|
979
|
+
if (running !== undefined) {
|
|
980
|
+
if (!force)
|
|
981
|
+
return running;
|
|
982
|
+
/*
|
|
983
|
+
* `force` znaczy „repo WŁAŚNIE się zmieniło" (koniec tury, zmiana w `.git`). Już lecący
|
|
984
|
+
* odczyt wystartował przed tą zmianą, więc oddanie jego wyniku pokazywałoby stan sprzed
|
|
985
|
+
* niej — po pushu w wierszu gita zostawałoby `↑2` (znalezisko audytu CR-04).
|
|
986
|
+
* Nie mnożymy procesów gita: czekamy, aż bieżący odczyt się domknie, i pytamy jeszcze raz.
|
|
987
|
+
* `#inFlight` jest wtedy już posprzątane (kasuje je `finally` poniżej), więc rekurencja
|
|
988
|
+
* schodzi dokładnie o jeden poziom.
|
|
989
|
+
*
|
|
990
|
+
* Pięć sesji jednego katalogu kończących tury w tej samej sekundzie to JEDEN odczyt
|
|
991
|
+
* po bieżącym, nie pięć po kolei: wszyscy, którzy wymuszają
|
|
992
|
+
* w oknie lecącego odczytu, dostają ten sam zaplanowany, a każdy taki odczyt i tak
|
|
993
|
+
* jest późniejszy niż zmiana, która go wywołała.
|
|
994
|
+
*/
|
|
995
|
+
const pending = this.#pendingForce.get(cwd);
|
|
996
|
+
if (pending !== undefined)
|
|
997
|
+
return pending;
|
|
998
|
+
const next = running.then(() => {
|
|
999
|
+
this.#pendingForce.delete(cwd);
|
|
1000
|
+
return this.status(cwd, true);
|
|
1001
|
+
});
|
|
1002
|
+
this.#pendingForce.set(cwd, next);
|
|
1003
|
+
return next;
|
|
1004
|
+
}
|
|
1005
|
+
const last = this.#lastRunAt.get(cwd);
|
|
1006
|
+
const now = this.#now();
|
|
1007
|
+
if (!force && last !== undefined && now - last < this.#throttleMs)
|
|
1008
|
+
return null;
|
|
1009
|
+
this.#lastRunAt.set(cwd, now);
|
|
1010
|
+
const promise = this.#collect(cwd)
|
|
1011
|
+
.catch(() => null)
|
|
1012
|
+
.finally(() => { this.#inFlight.delete(cwd); });
|
|
1013
|
+
this.#inFlight.set(cwd, promise);
|
|
1014
|
+
return promise;
|
|
1015
|
+
}
|
|
1016
|
+
/**
|
|
1017
|
+
* Odpala `status` i `log -1` RÓWNOLEGLE, skleja wynik, a dla brudnego repo dokłada liczniki
|
|
1018
|
+
* linii z `numstat` (po `status`, bo potrzebuje jego listy plików).
|
|
1019
|
+
*
|
|
1020
|
+
* Ostatni commit i liczniki są dodatkami: ich awaria (brak HEAD w świeżym repo, timeout)
|
|
1021
|
+
* zostawia status bez tych pól, ale nie kasuje wiersza gałęzi ani listy plików z rodzajami.
|
|
1022
|
+
*/
|
|
1023
|
+
async #collect(cwd) {
|
|
1024
|
+
const startedAt = this.#now();
|
|
1025
|
+
const failed = { ok: false, stdout: '' };
|
|
1026
|
+
const optional = (run) => (run === null ? Promise.resolve(failed) : run(cwd).catch(() => failed));
|
|
1027
|
+
const [statusResult, logResult] = await Promise.all([
|
|
1028
|
+
this.#run(cwd).catch(() => failed),
|
|
1029
|
+
optional(this.#runLog),
|
|
1030
|
+
]);
|
|
1031
|
+
if (!statusResult.ok) {
|
|
1032
|
+
this.#onCollect?.({ ms: this.#now() - startedAt, numstat: 'skipped' });
|
|
1033
|
+
return null;
|
|
1034
|
+
}
|
|
1035
|
+
const { status, pathspecs } = parsePorcelain(statusResult.stdout, this.#maxFiles);
|
|
1036
|
+
if (logResult.ok) {
|
|
1037
|
+
const commit = parseGitLog(logResult.stdout);
|
|
1038
|
+
if (commit !== null)
|
|
1039
|
+
status.lastCommit = commit;
|
|
1040
|
+
}
|
|
1041
|
+
const numstat = await this.#lineCounts(cwd, status, pathspecs);
|
|
1042
|
+
this.#onCollect?.({ ms: this.#now() - startedAt, numstat });
|
|
1043
|
+
return status;
|
|
1044
|
+
}
|
|
1045
|
+
/**
|
|
1046
|
+
* Dokłada liczniki linii do `status.fileDetails` (w miejscu) i mówi, jak poszło.
|
|
1047
|
+
*
|
|
1048
|
+
* Pomijany bez procesu, gdy nie ma czego liczyć (czyste repo, same nieśledzone, ścieżki
|
|
1049
|
+
* cytowane). Porażka i timeout zostawiają wpisy z samymi rodzajami — nigdy zgadywane zera.
|
|
1050
|
+
* Dopasowanie po ścieżce PO zmianie: tak samo stoi w `files` i tak samo oddaje ją `-z`.
|
|
1051
|
+
*/
|
|
1052
|
+
async #lineCounts(cwd, status, pathspecs) {
|
|
1053
|
+
const run = this.#runNumstat;
|
|
1054
|
+
if (run === null || pathspecs.length === 0)
|
|
1055
|
+
return 'skipped';
|
|
1056
|
+
const result = await run(numstatArgs(pathspecs), cwd)
|
|
1057
|
+
.catch(() => ({ ok: false, stdout: '' }));
|
|
1058
|
+
if (!result.ok)
|
|
1059
|
+
return result.timedOut === true ? 'timeout' : 'failed';
|
|
1060
|
+
const counts = parseNumstatZ(result.stdout);
|
|
1061
|
+
for (const detail of status.fileDetails) {
|
|
1062
|
+
const found = counts.get(detail.path);
|
|
1063
|
+
if (found !== undefined)
|
|
1064
|
+
Object.assign(detail, found);
|
|
1065
|
+
}
|
|
1066
|
+
return 'ok';
|
|
1067
|
+
}
|
|
1068
|
+
/** Kasuje pamięć throttle'a (np. po zamknięciu sesji). */
|
|
1069
|
+
forget(cwd) {
|
|
1070
|
+
this.#lastRunAt.delete(cwd);
|
|
1071
|
+
}
|
|
1072
|
+
}
|