karajan-code 3.3.0 → 3.4.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/README.md +1 -1
- package/node_modules/@karajan/core/README.md +42 -0
- package/node_modules/@karajan/core/package.json +38 -0
- package/node_modules/@karajan/core/src/atomic-write.js +43 -0
- package/node_modules/@karajan/core/src/cost/index.js +102 -0
- package/node_modules/@karajan/core/src/hu-snapshot.js +105 -0
- package/node_modules/@karajan/core/src/index.js +18 -0
- package/node_modules/@karajan/core/src/paths.js +123 -0
- package/node_modules/@karajan/core/src/plan-hu-ops.js +338 -0
- package/node_modules/@karajan/core/src/plan-id.js +45 -0
- package/node_modules/@karajan/core/src/plan-validation.js +82 -0
- package/node_modules/@karajan/core/src/port-check.js +45 -0
- package/node_modules/@karajan/core/src/pricing/index.js +64 -0
- package/node_modules/@karajan/core/src/pricing/model-pricing.json +28 -0
- package/node_modules/@karajan/core/src/process.js +188 -0
- package/node_modules/@karajan/core/src/run-registry.js +115 -0
- package/node_modules/@karajan/core/src/shared-paths.js +41 -0
- package/node_modules/@karajan/core/src/standby-scheduler.js +92 -0
- package/node_modules/@karajan/core/src/standby-store.js +168 -0
- package/node_modules/@karajan/core/src/vec-store.js +253 -0
- package/node_modules/@karajan/core/tests/atomic-write.test.js +30 -0
- package/node_modules/@karajan/core/tests/cost/index.test.js +89 -0
- package/node_modules/@karajan/core/tests/hu-snapshot.test.js +39 -0
- package/node_modules/@karajan/core/tests/paths.test.js +51 -0
- package/node_modules/@karajan/core/tests/plan-hu-ops.test.js +68 -0
- package/node_modules/@karajan/core/tests/plan-id.test.js +21 -0
- package/node_modules/@karajan/core/tests/plan-validation.test.js +39 -0
- package/node_modules/@karajan/core/tests/port-check.test.js +47 -0
- package/node_modules/@karajan/core/tests/pricing/index.test.js +95 -0
- package/node_modules/@karajan/core/tests/process.test.js +22 -0
- package/node_modules/@karajan/core/tests/run-registry.test.js +71 -0
- package/node_modules/@karajan/core/tests/shared-paths.test.js +30 -0
- package/node_modules/@karajan/core/tests/standby.test.js +66 -0
- package/node_modules/@karajan/core/tests/vec-store.test.js +98 -0
- package/node_modules/@karajan/core/vitest.config.js +12 -0
- package/node_modules/@sec-ant/readable-stream/LICENSE +21 -0
- package/node_modules/@sec-ant/readable-stream/README.md +230 -0
- package/node_modules/@sec-ant/readable-stream/dist/core/asyncIterablePrototype.d.ts +1 -0
- package/node_modules/@sec-ant/readable-stream/dist/core/asyncIterator.d.ts +27 -0
- package/node_modules/@sec-ant/readable-stream/dist/core/fromAnyIterable.d.ts +6 -0
- package/node_modules/@sec-ant/readable-stream/dist/index/asyncIterator.d.ts +2 -0
- package/node_modules/@sec-ant/readable-stream/dist/index/asyncIterator.js +5 -0
- package/node_modules/@sec-ant/readable-stream/dist/index/fromAnyIterable.d.ts +2 -0
- package/node_modules/@sec-ant/readable-stream/dist/index/fromAnyIterable.js +5 -0
- package/node_modules/@sec-ant/readable-stream/dist/index/index.d.ts +2 -0
- package/node_modules/@sec-ant/readable-stream/dist/index/index.js +8 -0
- package/node_modules/@sec-ant/readable-stream/dist/polyfill/asyncIterator.d.ts +1 -0
- package/node_modules/@sec-ant/readable-stream/dist/polyfill/asyncIterator.js +3 -0
- package/node_modules/@sec-ant/readable-stream/dist/polyfill/fromAnyIterable.d.ts +1 -0
- package/node_modules/@sec-ant/readable-stream/dist/polyfill/fromAnyIterable.js +2 -0
- package/node_modules/@sec-ant/readable-stream/dist/polyfill/index.d.ts +2 -0
- package/node_modules/@sec-ant/readable-stream/dist/polyfill/index.js +4 -0
- package/node_modules/@sec-ant/readable-stream/dist/ponyfill/asyncIterator.d.ts +1 -0
- package/node_modules/@sec-ant/readable-stream/dist/ponyfill/asyncIterator.js +89 -0
- package/node_modules/@sec-ant/readable-stream/dist/ponyfill/fromAnyIterable.d.ts +1 -0
- package/node_modules/@sec-ant/readable-stream/dist/ponyfill/fromAnyIterable.js +34 -0
- package/node_modules/@sec-ant/readable-stream/dist/ponyfill/index.d.ts +2 -0
- package/node_modules/@sec-ant/readable-stream/dist/ponyfill/index.js +6 -0
- package/node_modules/@sec-ant/readable-stream/dist/types/async-iterator.d.ts +11 -0
- package/node_modules/@sec-ant/readable-stream/package.json +96 -0
- package/node_modules/@sindresorhus/merge-streams/index.d.ts +44 -0
- package/node_modules/@sindresorhus/merge-streams/index.js +265 -0
- package/node_modules/@sindresorhus/merge-streams/license +9 -0
- package/node_modules/@sindresorhus/merge-streams/package.json +49 -0
- package/node_modules/@sindresorhus/merge-streams/readme.md +53 -0
- package/node_modules/base64-js/LICENSE +21 -0
- package/node_modules/base64-js/README.md +34 -0
- package/node_modules/base64-js/base64js.min.js +1 -0
- package/node_modules/base64-js/index.d.ts +3 -0
- package/node_modules/base64-js/index.js +150 -0
- package/node_modules/base64-js/package.json +47 -0
- package/node_modules/better-sqlite3/LICENSE +21 -0
- package/node_modules/better-sqlite3/README.md +99 -0
- package/node_modules/better-sqlite3/binding.gyp +38 -0
- package/node_modules/better-sqlite3/deps/common.gypi +68 -0
- package/node_modules/better-sqlite3/deps/copy.js +31 -0
- package/node_modules/better-sqlite3/deps/defines.gypi +42 -0
- package/node_modules/better-sqlite3/deps/download.sh +123 -0
- package/node_modules/better-sqlite3/deps/patches/1208.patch +15 -0
- package/node_modules/better-sqlite3/deps/sqlite3/sqlite3.c +268879 -0
- package/node_modules/better-sqlite3/deps/sqlite3/sqlite3.h +14335 -0
- package/node_modules/better-sqlite3/deps/sqlite3/sqlite3ext.h +739 -0
- package/node_modules/better-sqlite3/deps/sqlite3.gyp +80 -0
- package/node_modules/better-sqlite3/deps/test_extension.c +21 -0
- package/node_modules/better-sqlite3/lib/database.js +90 -0
- package/node_modules/better-sqlite3/lib/index.js +3 -0
- package/node_modules/better-sqlite3/lib/methods/aggregate.js +43 -0
- package/node_modules/better-sqlite3/lib/methods/backup.js +67 -0
- package/node_modules/better-sqlite3/lib/methods/function.js +31 -0
- package/node_modules/better-sqlite3/lib/methods/inspect.js +7 -0
- package/node_modules/better-sqlite3/lib/methods/pragma.js +12 -0
- package/node_modules/better-sqlite3/lib/methods/serialize.js +16 -0
- package/node_modules/better-sqlite3/lib/methods/table.js +189 -0
- package/node_modules/better-sqlite3/lib/methods/transaction.js +78 -0
- package/node_modules/better-sqlite3/lib/methods/wrappers.js +54 -0
- package/node_modules/better-sqlite3/lib/sqlite-error.js +20 -0
- package/node_modules/better-sqlite3/lib/util.js +12 -0
- package/node_modules/better-sqlite3/package.json +59 -0
- package/node_modules/better-sqlite3/src/addon.cpp +47 -0
- package/node_modules/better-sqlite3/src/better_sqlite3.cpp +74 -0
- package/node_modules/better-sqlite3/src/objects/backup.cpp +120 -0
- package/node_modules/better-sqlite3/src/objects/backup.hpp +36 -0
- package/node_modules/better-sqlite3/src/objects/database.cpp +417 -0
- package/node_modules/better-sqlite3/src/objects/database.hpp +103 -0
- package/node_modules/better-sqlite3/src/objects/statement-iterator.cpp +113 -0
- package/node_modules/better-sqlite3/src/objects/statement-iterator.hpp +50 -0
- package/node_modules/better-sqlite3/src/objects/statement.cpp +383 -0
- package/node_modules/better-sqlite3/src/objects/statement.hpp +58 -0
- package/node_modules/better-sqlite3/src/util/bind-map.cpp +73 -0
- package/node_modules/better-sqlite3/src/util/binder.cpp +193 -0
- package/node_modules/better-sqlite3/src/util/constants.cpp +172 -0
- package/node_modules/better-sqlite3/src/util/custom-aggregate.cpp +121 -0
- package/node_modules/better-sqlite3/src/util/custom-function.cpp +59 -0
- package/node_modules/better-sqlite3/src/util/custom-table.cpp +409 -0
- package/node_modules/better-sqlite3/src/util/data-converter.cpp +17 -0
- package/node_modules/better-sqlite3/src/util/data.cpp +194 -0
- package/node_modules/better-sqlite3/src/util/helpers.cpp +109 -0
- package/node_modules/better-sqlite3/src/util/macros.cpp +83 -0
- package/node_modules/better-sqlite3/src/util/query-macros.cpp +71 -0
- package/node_modules/better-sqlite3/src/util/row-builder.cpp +49 -0
- package/node_modules/bindings/LICENSE.md +22 -0
- package/node_modules/bindings/README.md +98 -0
- package/node_modules/bindings/bindings.js +221 -0
- package/node_modules/bindings/package.json +28 -0
- package/node_modules/bl/.travis.yml +17 -0
- package/node_modules/bl/BufferList.js +396 -0
- package/node_modules/bl/LICENSE.md +13 -0
- package/node_modules/bl/README.md +247 -0
- package/node_modules/bl/bl.js +84 -0
- package/node_modules/bl/package.json +37 -0
- package/node_modules/bl/test/convert.js +21 -0
- package/node_modules/bl/test/indexOf.js +492 -0
- package/node_modules/bl/test/isBufferList.js +32 -0
- package/node_modules/bl/test/test.js +869 -0
- package/node_modules/buffer/AUTHORS.md +70 -0
- package/node_modules/buffer/LICENSE +21 -0
- package/node_modules/buffer/README.md +410 -0
- package/node_modules/buffer/index.d.ts +186 -0
- package/node_modules/buffer/index.js +1817 -0
- package/node_modules/buffer/package.json +96 -0
- package/node_modules/chownr/LICENSE +15 -0
- package/node_modules/chownr/README.md +3 -0
- package/node_modules/chownr/chownr.js +167 -0
- package/node_modules/chownr/package.json +29 -0
- package/node_modules/cross-spawn/LICENSE +21 -0
- package/node_modules/cross-spawn/README.md +89 -0
- package/node_modules/cross-spawn/index.js +39 -0
- package/node_modules/cross-spawn/lib/enoent.js +59 -0
- package/node_modules/cross-spawn/lib/parse.js +91 -0
- package/node_modules/cross-spawn/lib/util/escape.js +47 -0
- package/node_modules/cross-spawn/lib/util/readShebang.js +23 -0
- package/node_modules/cross-spawn/lib/util/resolveCommand.js +52 -0
- package/node_modules/cross-spawn/package.json +73 -0
- package/node_modules/decompress-response/index.d.ts +22 -0
- package/node_modules/decompress-response/index.js +58 -0
- package/node_modules/decompress-response/license +9 -0
- package/node_modules/decompress-response/package.json +56 -0
- package/node_modules/decompress-response/readme.md +48 -0
- package/node_modules/deep-extend/LICENSE +20 -0
- package/node_modules/deep-extend/README.md +91 -0
- package/node_modules/deep-extend/index.js +1 -0
- package/node_modules/deep-extend/lib/deep-extend.js +150 -0
- package/node_modules/deep-extend/package.json +62 -0
- package/node_modules/detect-libc/LICENSE +201 -0
- package/node_modules/detect-libc/README.md +163 -0
- package/node_modules/detect-libc/index.d.ts +14 -0
- package/node_modules/detect-libc/lib/detect-libc.js +313 -0
- package/node_modules/detect-libc/lib/elf.js +39 -0
- package/node_modules/detect-libc/lib/filesystem.js +51 -0
- package/node_modules/detect-libc/lib/process.js +24 -0
- package/node_modules/detect-libc/package.json +44 -0
- package/node_modules/end-of-stream/LICENSE +21 -0
- package/node_modules/end-of-stream/README.md +54 -0
- package/node_modules/end-of-stream/index.js +96 -0
- package/node_modules/end-of-stream/package.json +37 -0
- package/node_modules/execa/index.d.ts +27 -0
- package/node_modules/execa/index.js +28 -0
- package/node_modules/execa/lib/arguments/command.js +20 -0
- package/node_modules/execa/lib/arguments/cwd.js +39 -0
- package/node_modules/execa/lib/arguments/encoding-option.js +50 -0
- package/node_modules/execa/lib/arguments/escape.js +88 -0
- package/node_modules/execa/lib/arguments/fd-options.js +108 -0
- package/node_modules/execa/lib/arguments/file-url.js +25 -0
- package/node_modules/execa/lib/arguments/options.js +96 -0
- package/node_modules/execa/lib/arguments/shell.js +11 -0
- package/node_modules/execa/lib/arguments/specific.js +111 -0
- package/node_modules/execa/lib/convert/add.js +15 -0
- package/node_modules/execa/lib/convert/concurrent.js +33 -0
- package/node_modules/execa/lib/convert/duplex.js +69 -0
- package/node_modules/execa/lib/convert/iterable.js +34 -0
- package/node_modules/execa/lib/convert/readable.js +113 -0
- package/node_modules/execa/lib/convert/shared.js +46 -0
- package/node_modules/execa/lib/convert/writable.js +90 -0
- package/node_modules/execa/lib/io/contents.js +116 -0
- package/node_modules/execa/lib/io/input-sync.js +44 -0
- package/node_modules/execa/lib/io/iterate.js +110 -0
- package/node_modules/execa/lib/io/max-buffer.js +89 -0
- package/node_modules/execa/lib/io/output-async.js +80 -0
- package/node_modules/execa/lib/io/output-sync.js +135 -0
- package/node_modules/execa/lib/io/pipeline.js +48 -0
- package/node_modules/execa/lib/io/strip-newline.js +12 -0
- package/node_modules/execa/lib/ipc/array.js +4 -0
- package/node_modules/execa/lib/ipc/buffer-messages.js +47 -0
- package/node_modules/execa/lib/ipc/forward.js +56 -0
- package/node_modules/execa/lib/ipc/get-each.js +89 -0
- package/node_modules/execa/lib/ipc/get-one.js +69 -0
- package/node_modules/execa/lib/ipc/graceful.js +72 -0
- package/node_modules/execa/lib/ipc/incoming.js +79 -0
- package/node_modules/execa/lib/ipc/ipc-input.js +44 -0
- package/node_modules/execa/lib/ipc/methods.js +49 -0
- package/node_modules/execa/lib/ipc/outgoing.js +47 -0
- package/node_modules/execa/lib/ipc/reference.js +44 -0
- package/node_modules/execa/lib/ipc/send.js +91 -0
- package/node_modules/execa/lib/ipc/strict.js +113 -0
- package/node_modules/execa/lib/ipc/validation.js +111 -0
- package/node_modules/execa/lib/methods/bind.js +23 -0
- package/node_modules/execa/lib/methods/command.js +43 -0
- package/node_modules/execa/lib/methods/create.js +65 -0
- package/node_modules/execa/lib/methods/main-async.js +194 -0
- package/node_modules/execa/lib/methods/main-sync.js +163 -0
- package/node_modules/execa/lib/methods/node.js +51 -0
- package/node_modules/execa/lib/methods/parameters.js +31 -0
- package/node_modules/execa/lib/methods/promise.js +15 -0
- package/node_modules/execa/lib/methods/script.js +22 -0
- package/node_modules/execa/lib/methods/template.js +153 -0
- package/node_modules/execa/lib/pipe/abort.js +20 -0
- package/node_modules/execa/lib/pipe/pipe-arguments.js +91 -0
- package/node_modules/execa/lib/pipe/sequence.js +24 -0
- package/node_modules/execa/lib/pipe/setup.js +72 -0
- package/node_modules/execa/lib/pipe/streaming.js +51 -0
- package/node_modules/execa/lib/pipe/throw.js +58 -0
- package/node_modules/execa/lib/resolve/all-async.js +46 -0
- package/node_modules/execa/lib/resolve/all-sync.js +33 -0
- package/node_modules/execa/lib/resolve/exit-async.js +54 -0
- package/node_modules/execa/lib/resolve/exit-sync.js +25 -0
- package/node_modules/execa/lib/resolve/stdio.js +47 -0
- package/node_modules/execa/lib/resolve/wait-stream.js +96 -0
- package/node_modules/execa/lib/resolve/wait-subprocess.js +146 -0
- package/node_modules/execa/lib/return/duration.js +8 -0
- package/node_modules/execa/lib/return/early-error.js +60 -0
- package/node_modules/execa/lib/return/final-error.js +40 -0
- package/node_modules/execa/lib/return/message.js +157 -0
- package/node_modules/execa/lib/return/reject.js +13 -0
- package/node_modules/execa/lib/return/result.js +186 -0
- package/node_modules/execa/lib/stdio/direction.js +76 -0
- package/node_modules/execa/lib/stdio/duplicate.js +116 -0
- package/node_modules/execa/lib/stdio/handle-async.js +52 -0
- package/node_modules/execa/lib/stdio/handle-sync.js +57 -0
- package/node_modules/execa/lib/stdio/handle.js +214 -0
- package/node_modules/execa/lib/stdio/input-option.js +50 -0
- package/node_modules/execa/lib/stdio/native.js +106 -0
- package/node_modules/execa/lib/stdio/stdio-option.js +60 -0
- package/node_modules/execa/lib/stdio/type.js +173 -0
- package/node_modules/execa/lib/terminate/cancel.js +20 -0
- package/node_modules/execa/lib/terminate/cleanup.js +16 -0
- package/node_modules/execa/lib/terminate/graceful.js +71 -0
- package/node_modules/execa/lib/terminate/kill.js +93 -0
- package/node_modules/execa/lib/terminate/signal.js +70 -0
- package/node_modules/execa/lib/terminate/timeout.js +21 -0
- package/node_modules/execa/lib/transform/encoding-transform.js +51 -0
- package/node_modules/execa/lib/transform/generator.js +107 -0
- package/node_modules/execa/lib/transform/normalize.js +111 -0
- package/node_modules/execa/lib/transform/object-mode.js +41 -0
- package/node_modules/execa/lib/transform/run-async.js +60 -0
- package/node_modules/execa/lib/transform/run-sync.js +50 -0
- package/node_modules/execa/lib/transform/split.js +110 -0
- package/node_modules/execa/lib/transform/validate.js +43 -0
- package/node_modules/execa/lib/utils/abort-signal.js +8 -0
- package/node_modules/execa/lib/utils/deferred.js +7 -0
- package/node_modules/execa/lib/utils/max-listeners.js +14 -0
- package/node_modules/execa/lib/utils/standard-stream.js +6 -0
- package/node_modules/execa/lib/utils/uint-array.js +69 -0
- package/node_modules/execa/lib/verbose/complete.js +24 -0
- package/node_modules/execa/lib/verbose/custom.js +26 -0
- package/node_modules/execa/lib/verbose/default.js +54 -0
- package/node_modules/execa/lib/verbose/error.js +13 -0
- package/node_modules/execa/lib/verbose/info.js +39 -0
- package/node_modules/execa/lib/verbose/ipc.js +15 -0
- package/node_modules/execa/lib/verbose/log.js +54 -0
- package/node_modules/execa/lib/verbose/output.js +60 -0
- package/node_modules/execa/lib/verbose/start.js +15 -0
- package/node_modules/execa/lib/verbose/values.js +33 -0
- package/node_modules/execa/license +9 -0
- package/node_modules/execa/package.json +105 -0
- package/node_modules/execa/readme.md +461 -0
- package/node_modules/execa/types/arguments/encoding-option.d.ts +19 -0
- package/node_modules/execa/types/arguments/fd-options.d.ts +8 -0
- package/node_modules/execa/types/arguments/options.d.ts +400 -0
- package/node_modules/execa/types/arguments/specific.d.ts +52 -0
- package/node_modules/execa/types/convert.d.ts +58 -0
- package/node_modules/execa/types/ipc.d.ts +156 -0
- package/node_modules/execa/types/methods/command.d.ts +114 -0
- package/node_modules/execa/types/methods/main-async.d.ts +379 -0
- package/node_modules/execa/types/methods/main-sync.d.ts +59 -0
- package/node_modules/execa/types/methods/node.d.ts +62 -0
- package/node_modules/execa/types/methods/script.d.ts +115 -0
- package/node_modules/execa/types/methods/template.d.ts +18 -0
- package/node_modules/execa/types/pipe.d.ts +58 -0
- package/node_modules/execa/types/return/final-error.d.ts +51 -0
- package/node_modules/execa/types/return/ignore.d.ts +26 -0
- package/node_modules/execa/types/return/result-all.d.ts +30 -0
- package/node_modules/execa/types/return/result-ipc.d.ts +27 -0
- package/node_modules/execa/types/return/result-stdio.d.ts +17 -0
- package/node_modules/execa/types/return/result-stdout.d.ts +50 -0
- package/node_modules/execa/types/return/result.d.ts +203 -0
- package/node_modules/execa/types/stdio/array.d.ts +16 -0
- package/node_modules/execa/types/stdio/direction.d.ts +12 -0
- package/node_modules/execa/types/stdio/option.d.ts +40 -0
- package/node_modules/execa/types/stdio/type.d.ts +170 -0
- package/node_modules/execa/types/subprocess/all.d.ts +17 -0
- package/node_modules/execa/types/subprocess/stdio.d.ts +18 -0
- package/node_modules/execa/types/subprocess/stdout.d.ts +22 -0
- package/node_modules/execa/types/subprocess/subprocess.d.ts +117 -0
- package/node_modules/execa/types/transform/normalize.d.ts +57 -0
- package/node_modules/execa/types/transform/object-mode.d.ts +21 -0
- package/node_modules/execa/types/utils.d.ts +13 -0
- package/node_modules/execa/types/verbose.d.ts +98 -0
- package/node_modules/expand-template/.travis.yml +6 -0
- package/node_modules/expand-template/LICENSE +21 -0
- package/node_modules/expand-template/README.md +43 -0
- package/node_modules/expand-template/index.js +26 -0
- package/node_modules/expand-template/package.json +29 -0
- package/node_modules/expand-template/test.js +67 -0
- package/node_modules/figures/index.d.ts +279 -0
- package/node_modules/figures/index.js +292 -0
- package/node_modules/figures/license +9 -0
- package/node_modules/figures/package.json +49 -0
- package/node_modules/figures/readme.md +337 -0
- package/node_modules/file-uri-to-path/.npmignore +1 -0
- package/node_modules/file-uri-to-path/.travis.yml +30 -0
- package/node_modules/file-uri-to-path/History.md +21 -0
- package/node_modules/file-uri-to-path/LICENSE +20 -0
- package/node_modules/file-uri-to-path/README.md +74 -0
- package/node_modules/file-uri-to-path/index.d.ts +2 -0
- package/node_modules/file-uri-to-path/index.js +66 -0
- package/node_modules/file-uri-to-path/package.json +32 -0
- package/node_modules/file-uri-to-path/test/test.js +24 -0
- package/node_modules/file-uri-to-path/test/tests.json +13 -0
- package/node_modules/fs-constants/LICENSE +21 -0
- package/node_modules/fs-constants/README.md +26 -0
- package/node_modules/fs-constants/browser.js +1 -0
- package/node_modules/fs-constants/index.js +1 -0
- package/node_modules/fs-constants/package.json +19 -0
- package/node_modules/get-stream/license +9 -0
- package/node_modules/get-stream/package.json +60 -0
- package/node_modules/get-stream/readme.md +303 -0
- package/node_modules/get-stream/source/array-buffer.js +84 -0
- package/node_modules/get-stream/source/array.js +32 -0
- package/node_modules/get-stream/source/buffer.js +19 -0
- package/node_modules/get-stream/source/contents.js +121 -0
- package/node_modules/get-stream/source/exports.js +5 -0
- package/node_modules/get-stream/source/index.d.ts +121 -0
- package/node_modules/get-stream/source/index.js +13 -0
- package/node_modules/get-stream/source/stream.js +65 -0
- package/node_modules/get-stream/source/string.js +41 -0
- package/node_modules/get-stream/source/utils.js +11 -0
- package/node_modules/github-from-package/.travis.yml +4 -0
- package/node_modules/github-from-package/LICENSE +18 -0
- package/node_modules/github-from-package/example/package.json +8 -0
- package/node_modules/github-from-package/example/url.js +3 -0
- package/node_modules/github-from-package/index.js +17 -0
- package/node_modules/github-from-package/package.json +30 -0
- package/node_modules/github-from-package/readme.markdown +53 -0
- package/node_modules/github-from-package/test/a.json +8 -0
- package/node_modules/github-from-package/test/b.json +5 -0
- package/node_modules/github-from-package/test/c.json +5 -0
- package/node_modules/github-from-package/test/d.json +7 -0
- package/node_modules/github-from-package/test/e.json +5 -0
- package/node_modules/github-from-package/test/url.js +19 -0
- package/node_modules/human-signals/LICENSE +201 -0
- package/node_modules/human-signals/README.md +171 -0
- package/node_modules/human-signals/build/src/core.js +273 -0
- package/node_modules/human-signals/build/src/main.d.ts +206 -0
- package/node_modules/human-signals/build/src/main.js +70 -0
- package/node_modules/human-signals/build/src/realtime.js +16 -0
- package/node_modules/human-signals/build/src/signals.js +34 -0
- package/node_modules/human-signals/package.json +66 -0
- package/node_modules/ieee754/LICENSE +11 -0
- package/node_modules/ieee754/README.md +51 -0
- package/node_modules/ieee754/index.d.ts +10 -0
- package/node_modules/ieee754/index.js +85 -0
- package/node_modules/ieee754/package.json +52 -0
- package/node_modules/inherits/LICENSE +16 -0
- package/node_modules/inherits/README.md +42 -0
- package/node_modules/inherits/inherits.js +9 -0
- package/node_modules/inherits/inherits_browser.js +27 -0
- package/node_modules/inherits/package.json +29 -0
- package/node_modules/ini/LICENSE +15 -0
- package/node_modules/ini/README.md +102 -0
- package/node_modules/ini/ini.js +206 -0
- package/node_modules/ini/package.json +33 -0
- package/node_modules/is-plain-obj/index.d.ts +35 -0
- package/node_modules/is-plain-obj/index.js +8 -0
- package/node_modules/is-plain-obj/license +9 -0
- package/node_modules/is-plain-obj/package.json +41 -0
- package/node_modules/is-plain-obj/readme.md +58 -0
- package/node_modules/is-stream/index.d.ts +90 -0
- package/node_modules/is-stream/index.js +37 -0
- package/node_modules/is-stream/license +9 -0
- package/node_modules/is-stream/package.json +48 -0
- package/node_modules/is-stream/readme.md +57 -0
- package/node_modules/is-unicode-supported/index.d.ts +12 -0
- package/node_modules/is-unicode-supported/index.js +21 -0
- package/node_modules/is-unicode-supported/license +9 -0
- package/node_modules/is-unicode-supported/package.json +47 -0
- package/node_modules/is-unicode-supported/readme.md +35 -0
- package/node_modules/isexe/.npmignore +2 -0
- package/node_modules/isexe/LICENSE +15 -0
- package/node_modules/isexe/README.md +51 -0
- package/node_modules/isexe/index.js +57 -0
- package/node_modules/isexe/mode.js +41 -0
- package/node_modules/isexe/package.json +31 -0
- package/node_modules/isexe/test/basic.js +221 -0
- package/node_modules/isexe/windows.js +42 -0
- package/node_modules/mimic-response/index.d.ts +17 -0
- package/node_modules/mimic-response/index.js +77 -0
- package/node_modules/mimic-response/license +9 -0
- package/node_modules/mimic-response/package.json +42 -0
- package/node_modules/mimic-response/readme.md +78 -0
- package/node_modules/minimist/.eslintrc +29 -0
- package/node_modules/minimist/.github/FUNDING.yml +12 -0
- package/node_modules/minimist/.nycrc +14 -0
- package/node_modules/minimist/CHANGELOG.md +298 -0
- package/node_modules/minimist/LICENSE +18 -0
- package/node_modules/minimist/README.md +121 -0
- package/node_modules/minimist/example/parse.js +4 -0
- package/node_modules/minimist/index.js +263 -0
- package/node_modules/minimist/package.json +75 -0
- package/node_modules/minimist/test/all_bool.js +34 -0
- package/node_modules/minimist/test/bool.js +177 -0
- package/node_modules/minimist/test/dash.js +43 -0
- package/node_modules/minimist/test/default_bool.js +37 -0
- package/node_modules/minimist/test/dotted.js +24 -0
- package/node_modules/minimist/test/kv_short.js +32 -0
- package/node_modules/minimist/test/long.js +33 -0
- package/node_modules/minimist/test/num.js +38 -0
- package/node_modules/minimist/test/parse.js +209 -0
- package/node_modules/minimist/test/parse_modified.js +11 -0
- package/node_modules/minimist/test/proto.js +64 -0
- package/node_modules/minimist/test/short.js +69 -0
- package/node_modules/minimist/test/stop_early.js +17 -0
- package/node_modules/minimist/test/unknown.js +104 -0
- package/node_modules/minimist/test/whitespace.js +10 -0
- package/node_modules/mkdirp-classic/LICENSE +21 -0
- package/node_modules/mkdirp-classic/README.md +18 -0
- package/node_modules/mkdirp-classic/index.js +98 -0
- package/node_modules/mkdirp-classic/package.json +18 -0
- package/node_modules/napi-build-utils/.github/workflows/run-npm-tests.yml +31 -0
- package/node_modules/napi-build-utils/LICENSE +21 -0
- package/node_modules/napi-build-utils/README.md +52 -0
- package/node_modules/napi-build-utils/index.js +214 -0
- package/node_modules/napi-build-utils/index.md +0 -0
- package/node_modules/napi-build-utils/package.json +42 -0
- package/node_modules/node-abi/LICENSE +21 -0
- package/node_modules/node-abi/README.md +54 -0
- package/node_modules/node-abi/abi_registry.json +446 -0
- package/node_modules/node-abi/index.js +179 -0
- package/node_modules/node-abi/package.json +45 -0
- package/node_modules/npm-run-path/index.d.ts +90 -0
- package/node_modules/npm-run-path/index.js +55 -0
- package/node_modules/npm-run-path/license +9 -0
- package/node_modules/npm-run-path/node_modules/path-key/index.d.ts +31 -0
- package/node_modules/npm-run-path/node_modules/path-key/index.js +12 -0
- package/node_modules/npm-run-path/node_modules/path-key/license +9 -0
- package/node_modules/npm-run-path/node_modules/path-key/package.json +41 -0
- package/node_modules/npm-run-path/node_modules/path-key/readme.md +57 -0
- package/node_modules/npm-run-path/package.json +52 -0
- package/node_modules/npm-run-path/readme.md +104 -0
- package/node_modules/once/LICENSE +15 -0
- package/node_modules/once/README.md +79 -0
- package/node_modules/once/once.js +42 -0
- package/node_modules/once/package.json +33 -0
- package/node_modules/parse-ms/index.d.ts +30 -0
- package/node_modules/parse-ms/index.js +45 -0
- package/node_modules/parse-ms/license +9 -0
- package/node_modules/parse-ms/package.json +47 -0
- package/node_modules/parse-ms/readme.md +46 -0
- package/node_modules/path-key/index.d.ts +40 -0
- package/node_modules/path-key/index.js +16 -0
- package/node_modules/path-key/license +9 -0
- package/node_modules/path-key/package.json +39 -0
- package/node_modules/path-key/readme.md +61 -0
- package/node_modules/prebuild-install/CHANGELOG.md +131 -0
- package/node_modules/prebuild-install/CONTRIBUTING.md +6 -0
- package/node_modules/prebuild-install/LICENSE +21 -0
- package/node_modules/prebuild-install/README.md +163 -0
- package/node_modules/prebuild-install/asset.js +44 -0
- package/node_modules/prebuild-install/bin.js +78 -0
- package/node_modules/prebuild-install/download.js +142 -0
- package/node_modules/prebuild-install/error.js +14 -0
- package/node_modules/prebuild-install/help.txt +16 -0
- package/node_modules/prebuild-install/index.js +1 -0
- package/node_modules/prebuild-install/log.js +33 -0
- package/node_modules/prebuild-install/package.json +67 -0
- package/node_modules/prebuild-install/proxy.js +35 -0
- package/node_modules/prebuild-install/rc.js +64 -0
- package/node_modules/prebuild-install/util.js +143 -0
- package/node_modules/pretty-ms/index.d.ts +157 -0
- package/node_modules/pretty-ms/index.js +149 -0
- package/node_modules/pretty-ms/license +9 -0
- package/node_modules/pretty-ms/package.json +55 -0
- package/node_modules/pretty-ms/readme.md +179 -0
- package/node_modules/pump/.github/FUNDING.yml +2 -0
- package/node_modules/pump/.travis.yml +5 -0
- package/node_modules/pump/LICENSE +21 -0
- package/node_modules/pump/README.md +74 -0
- package/node_modules/pump/SECURITY.md +5 -0
- package/node_modules/pump/empty.js +1 -0
- package/node_modules/pump/index.js +86 -0
- package/node_modules/pump/package.json +30 -0
- package/node_modules/pump/test-browser.js +66 -0
- package/node_modules/pump/test-node.js +53 -0
- package/node_modules/rc/LICENSE.APACHE2 +15 -0
- package/node_modules/rc/LICENSE.BSD +26 -0
- package/node_modules/rc/LICENSE.MIT +24 -0
- package/node_modules/rc/README.md +227 -0
- package/node_modules/rc/browser.js +7 -0
- package/node_modules/rc/cli.js +4 -0
- package/node_modules/rc/index.js +53 -0
- package/node_modules/rc/lib/utils.js +104 -0
- package/node_modules/rc/package.json +29 -0
- package/node_modules/rc/test/ini.js +16 -0
- package/node_modules/rc/test/nested-env-vars.js +50 -0
- package/node_modules/rc/test/test.js +59 -0
- package/node_modules/readable-stream/CONTRIBUTING.md +38 -0
- package/node_modules/readable-stream/GOVERNANCE.md +136 -0
- package/node_modules/readable-stream/LICENSE +47 -0
- package/node_modules/readable-stream/README.md +106 -0
- package/node_modules/readable-stream/errors-browser.js +127 -0
- package/node_modules/readable-stream/errors.js +116 -0
- package/node_modules/readable-stream/experimentalWarning.js +17 -0
- package/node_modules/readable-stream/lib/_stream_duplex.js +126 -0
- package/node_modules/readable-stream/lib/_stream_passthrough.js +37 -0
- package/node_modules/readable-stream/lib/_stream_readable.js +1027 -0
- package/node_modules/readable-stream/lib/_stream_transform.js +190 -0
- package/node_modules/readable-stream/lib/_stream_writable.js +641 -0
- package/node_modules/readable-stream/lib/internal/streams/async_iterator.js +180 -0
- package/node_modules/readable-stream/lib/internal/streams/buffer_list.js +183 -0
- package/node_modules/readable-stream/lib/internal/streams/destroy.js +96 -0
- package/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +86 -0
- package/node_modules/readable-stream/lib/internal/streams/from-browser.js +3 -0
- package/node_modules/readable-stream/lib/internal/streams/from.js +52 -0
- package/node_modules/readable-stream/lib/internal/streams/pipeline.js +86 -0
- package/node_modules/readable-stream/lib/internal/streams/state.js +22 -0
- package/node_modules/readable-stream/lib/internal/streams/stream-browser.js +1 -0
- package/node_modules/readable-stream/lib/internal/streams/stream.js +1 -0
- package/node_modules/readable-stream/package.json +68 -0
- package/node_modules/readable-stream/readable-browser.js +9 -0
- package/node_modules/readable-stream/readable.js +16 -0
- package/node_modules/safe-buffer/LICENSE +21 -0
- package/node_modules/safe-buffer/README.md +584 -0
- package/node_modules/safe-buffer/index.d.ts +187 -0
- package/node_modules/safe-buffer/index.js +65 -0
- package/node_modules/safe-buffer/package.json +51 -0
- package/node_modules/semver/LICENSE +15 -0
- package/node_modules/semver/README.md +665 -0
- package/node_modules/semver/bin/semver.js +191 -0
- package/node_modules/semver/classes/comparator.js +143 -0
- package/node_modules/semver/classes/index.js +7 -0
- package/node_modules/semver/classes/range.js +557 -0
- package/node_modules/semver/classes/semver.js +333 -0
- package/node_modules/semver/functions/clean.js +8 -0
- package/node_modules/semver/functions/cmp.js +54 -0
- package/node_modules/semver/functions/coerce.js +62 -0
- package/node_modules/semver/functions/compare-build.js +9 -0
- package/node_modules/semver/functions/compare-loose.js +5 -0
- package/node_modules/semver/functions/compare.js +7 -0
- package/node_modules/semver/functions/diff.js +60 -0
- package/node_modules/semver/functions/eq.js +5 -0
- package/node_modules/semver/functions/gt.js +5 -0
- package/node_modules/semver/functions/gte.js +5 -0
- package/node_modules/semver/functions/inc.js +21 -0
- package/node_modules/semver/functions/lt.js +5 -0
- package/node_modules/semver/functions/lte.js +5 -0
- package/node_modules/semver/functions/major.js +5 -0
- package/node_modules/semver/functions/minor.js +5 -0
- package/node_modules/semver/functions/neq.js +5 -0
- package/node_modules/semver/functions/parse.js +18 -0
- package/node_modules/semver/functions/patch.js +5 -0
- package/node_modules/semver/functions/prerelease.js +8 -0
- package/node_modules/semver/functions/rcompare.js +5 -0
- package/node_modules/semver/functions/rsort.js +5 -0
- package/node_modules/semver/functions/satisfies.js +12 -0
- package/node_modules/semver/functions/sort.js +5 -0
- package/node_modules/semver/functions/valid.js +8 -0
- package/node_modules/semver/index.js +91 -0
- package/node_modules/semver/internal/constants.js +37 -0
- package/node_modules/semver/internal/debug.js +11 -0
- package/node_modules/semver/internal/identifiers.js +29 -0
- package/node_modules/semver/internal/lrucache.js +42 -0
- package/node_modules/semver/internal/parse-options.js +17 -0
- package/node_modules/semver/internal/re.js +223 -0
- package/node_modules/semver/package.json +78 -0
- package/node_modules/semver/preload.js +4 -0
- package/node_modules/semver/range.bnf +16 -0
- package/node_modules/semver/ranges/gtr.js +6 -0
- package/node_modules/semver/ranges/intersects.js +9 -0
- package/node_modules/semver/ranges/ltr.js +6 -0
- package/node_modules/semver/ranges/max-satisfying.js +27 -0
- package/node_modules/semver/ranges/min-satisfying.js +26 -0
- package/node_modules/semver/ranges/min-version.js +63 -0
- package/node_modules/semver/ranges/outside.js +82 -0
- package/node_modules/semver/ranges/simplify.js +49 -0
- package/node_modules/semver/ranges/subset.js +249 -0
- package/node_modules/semver/ranges/to-comparators.js +10 -0
- package/node_modules/semver/ranges/valid.js +13 -0
- package/node_modules/shebang-command/index.js +19 -0
- package/node_modules/shebang-command/license +9 -0
- package/node_modules/shebang-command/package.json +34 -0
- package/node_modules/shebang-command/readme.md +34 -0
- package/node_modules/shebang-regex/index.d.ts +22 -0
- package/node_modules/shebang-regex/index.js +2 -0
- package/node_modules/shebang-regex/license +9 -0
- package/node_modules/shebang-regex/package.json +35 -0
- package/node_modules/shebang-regex/readme.md +33 -0
- package/node_modules/signal-exit/LICENSE.txt +16 -0
- package/node_modules/signal-exit/README.md +74 -0
- package/node_modules/signal-exit/dist/cjs/browser.d.ts +12 -0
- package/node_modules/signal-exit/dist/cjs/browser.d.ts.map +1 -0
- package/node_modules/signal-exit/dist/cjs/browser.js +10 -0
- package/node_modules/signal-exit/dist/cjs/browser.js.map +1 -0
- package/node_modules/signal-exit/dist/cjs/index.d.ts +48 -0
- package/node_modules/signal-exit/dist/cjs/index.d.ts.map +1 -0
- package/node_modules/signal-exit/dist/cjs/index.js +279 -0
- package/node_modules/signal-exit/dist/cjs/index.js.map +1 -0
- package/node_modules/signal-exit/dist/cjs/package.json +3 -0
- package/node_modules/signal-exit/dist/cjs/signals.d.ts +29 -0
- package/node_modules/signal-exit/dist/cjs/signals.d.ts.map +1 -0
- package/node_modules/signal-exit/dist/cjs/signals.js +42 -0
- package/node_modules/signal-exit/dist/cjs/signals.js.map +1 -0
- package/node_modules/signal-exit/dist/mjs/browser.d.ts +12 -0
- package/node_modules/signal-exit/dist/mjs/browser.d.ts.map +1 -0
- package/node_modules/signal-exit/dist/mjs/browser.js +4 -0
- package/node_modules/signal-exit/dist/mjs/browser.js.map +1 -0
- package/node_modules/signal-exit/dist/mjs/index.d.ts +48 -0
- package/node_modules/signal-exit/dist/mjs/index.d.ts.map +1 -0
- package/node_modules/signal-exit/dist/mjs/index.js +275 -0
- package/node_modules/signal-exit/dist/mjs/index.js.map +1 -0
- package/node_modules/signal-exit/dist/mjs/package.json +3 -0
- package/node_modules/signal-exit/dist/mjs/signals.d.ts +29 -0
- package/node_modules/signal-exit/dist/mjs/signals.d.ts.map +1 -0
- package/node_modules/signal-exit/dist/mjs/signals.js +39 -0
- package/node_modules/signal-exit/dist/mjs/signals.js.map +1 -0
- package/node_modules/signal-exit/package.json +106 -0
- package/node_modules/simple-concat/.travis.yml +3 -0
- package/node_modules/simple-concat/LICENSE +20 -0
- package/node_modules/simple-concat/README.md +44 -0
- package/node_modules/simple-concat/index.js +15 -0
- package/node_modules/simple-concat/package.json +47 -0
- package/node_modules/simple-concat/test/basic.js +41 -0
- package/node_modules/simple-get/.github/dependabot.yml +15 -0
- package/node_modules/simple-get/.github/workflows/ci.yml +23 -0
- package/node_modules/simple-get/LICENSE +20 -0
- package/node_modules/simple-get/README.md +333 -0
- package/node_modules/simple-get/index.js +108 -0
- package/node_modules/simple-get/package.json +67 -0
- package/node_modules/sqlite-vec/README.md +1 -0
- package/node_modules/sqlite-vec/package.json +1 -0
- package/node_modules/sqlite-vec-linux-x64/README.md +1 -0
- package/node_modules/sqlite-vec-linux-x64/package.json +1 -0
- package/node_modules/string_decoder/LICENSE +48 -0
- package/node_modules/string_decoder/README.md +47 -0
- package/node_modules/string_decoder/lib/string_decoder.js +296 -0
- package/node_modules/string_decoder/package.json +34 -0
- package/node_modules/strip-final-newline/index.d.ts +18 -0
- package/node_modules/strip-final-newline/index.js +26 -0
- package/node_modules/strip-final-newline/license +9 -0
- package/node_modules/strip-final-newline/package.json +49 -0
- package/node_modules/strip-final-newline/readme.md +34 -0
- package/node_modules/strip-json-comments/index.js +70 -0
- package/node_modules/strip-json-comments/license +21 -0
- package/node_modules/strip-json-comments/package.json +42 -0
- package/node_modules/strip-json-comments/readme.md +64 -0
- package/node_modules/tar-fs/.travis.yml +6 -0
- package/node_modules/tar-fs/LICENSE +21 -0
- package/node_modules/tar-fs/README.md +165 -0
- package/node_modules/tar-fs/index.js +363 -0
- package/node_modules/tar-fs/package.json +41 -0
- package/node_modules/tar-fs/test/fixtures/a/hello.txt +1 -0
- package/node_modules/tar-fs/test/fixtures/b/a/test.txt +1 -0
- package/node_modules/tar-fs/test/fixtures/d/file1 +0 -0
- package/node_modules/tar-fs/test/fixtures/d/file2 +0 -0
- package/node_modules/tar-fs/test/fixtures/d/sub-dir/file5 +0 -0
- package/node_modules/tar-fs/test/fixtures/d/sub-files/file3 +0 -0
- package/node_modules/tar-fs/test/fixtures/d/sub-files/file4 +0 -0
- package/node_modules/tar-fs/test/fixtures/e/directory/.ignore +0 -0
- package/node_modules/tar-fs/test/fixtures/e/file +0 -0
- package/node_modules/tar-fs/test/fixtures/invalid.tar +0 -0
- package/node_modules/tar-fs/test/index.js +346 -0
- package/node_modules/tar-stream/LICENSE +21 -0
- package/node_modules/tar-stream/README.md +168 -0
- package/node_modules/tar-stream/extract.js +257 -0
- package/node_modules/tar-stream/headers.js +295 -0
- package/node_modules/tar-stream/index.js +2 -0
- package/node_modules/tar-stream/pack.js +255 -0
- package/node_modules/tar-stream/package.json +58 -0
- package/node_modules/tar-stream/sandbox.js +11 -0
- package/node_modules/tunnel-agent/LICENSE +55 -0
- package/node_modules/tunnel-agent/README.md +4 -0
- package/node_modules/tunnel-agent/index.js +244 -0
- package/node_modules/tunnel-agent/package.json +22 -0
- package/node_modules/unicorn-magic/default.d.ts +13 -0
- package/node_modules/unicorn-magic/default.js +14 -0
- package/node_modules/unicorn-magic/license +9 -0
- package/node_modules/unicorn-magic/node.d.ts +125 -0
- package/node_modules/unicorn-magic/node.js +49 -0
- package/node_modules/unicorn-magic/package.json +62 -0
- package/node_modules/unicorn-magic/readme.md +25 -0
- package/node_modules/util-deprecate/History.md +16 -0
- package/node_modules/util-deprecate/LICENSE +24 -0
- package/node_modules/util-deprecate/README.md +53 -0
- package/node_modules/util-deprecate/browser.js +67 -0
- package/node_modules/util-deprecate/node.js +6 -0
- package/node_modules/util-deprecate/package.json +27 -0
- package/node_modules/which/LICENSE +15 -0
- package/node_modules/which/README.md +54 -0
- package/node_modules/which/bin/node-which +52 -0
- package/node_modules/which/package.json +43 -0
- package/node_modules/which/which.js +125 -0
- package/node_modules/wrappy/LICENSE +15 -0
- package/node_modules/wrappy/README.md +36 -0
- package/node_modules/wrappy/package.json +29 -0
- package/node_modules/wrappy/wrappy.js +33 -0
- package/node_modules/yoctocolors/base.d.ts +47 -0
- package/node_modules/yoctocolors/base.js +94 -0
- package/node_modules/yoctocolors/index.d.ts +2 -0
- package/node_modules/yoctocolors/index.js +2 -0
- package/node_modules/yoctocolors/license +9 -0
- package/node_modules/yoctocolors/package.json +69 -0
- package/node_modules/yoctocolors/readme.md +138 -0
- package/package.json +5 -1
- package/packages/hu-board/src/routes/api.js +70 -49
- package/packages/hu-board/src/zombie-reaper.js +1 -1
- package/src/agents/aider-agent.js +1 -1
- package/src/agents/claude-agent.js +17 -2
- package/src/agents/gemini-agent.js +1 -1
- package/src/agents/opencode-agent.js +1 -1
- package/src/audit/agent-readiness.js +2 -1
- package/src/audit/deterministic-summary.js +11 -5
- package/src/audit/issue-filter.js +3 -6
- package/src/audit/plan-adherence.js +3 -1
- package/src/audit/semgrep-findings.js +5 -1
- package/src/brain/agent-error-classifier.js +8 -1
- package/src/brain/decisor.js +2 -2
- package/src/brain/solomon-consult.js +2 -2
- package/src/brain/standby-scheduler.js +0 -2
- package/src/commands/audit.js +8 -3
- package/src/commands/board.js +1 -1
- package/src/commands/standby.js +4 -1
- package/src/config/loader.js +2 -2
- package/src/golden/asserter.js +3 -1
- package/src/golden/schema.js +1 -1
- package/src/hu/auto-generator.js +1 -1
- package/src/lang/tree-sitter-loader.js +1 -5
- package/src/mcp/handlers/management-handlers.js +4 -3
- package/src/orchestrator/drivers/post-loop.js +43 -91
- package/src/orchestrator/flow-runner.js +25 -0
- package/src/orchestrator/fs-leak-detector.js +6 -1
- package/src/orchestrator/preflight-checks.js +51 -0
- package/src/orchestrator/solomon-rules.js +12 -1
- package/src/prompts/architect.js +32 -37
- package/src/prompts/audit.js +12 -11
- package/src/prompts/coder.js +71 -96
- package/src/prompts/hu-reviewer.js +23 -29
- package/src/prompts/planner.js +1 -1
- package/src/prompts/prompt-layout.js +80 -0
- package/src/prompts/reviewer.js +34 -39
- package/src/rag/embedders/factory.js +0 -1
- package/src/rag/retriever.js +1 -1
- package/src/roles/agent-role.js +10 -2
- package/src/roles/audit-role.js +10 -2
- package/src/roles/coder-role.js +6 -3
- package/src/roles/reviewer-role.js +20 -23
- package/src/session/journal/write-all.js +89 -0
- package/src/sonar/discovery.js +2 -1
- package/src/sonar/scanner.js +1 -1
- package/src/utils/cli-progress.js +4 -2
- package/src/utils/escape-regexp.js +15 -0
- package/src/utils/paths.js +0 -1
- package/src/utils/port-occupant.js +2 -1
- package/src/utils/project-detect.js +1 -1
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { execa } from "execa";
|
|
2
|
+
|
|
3
|
+
const isWin = process.platform === "win32";
|
|
4
|
+
const KILL_SIGNAL = isWin ? "SIGTERM" : "SIGKILL";
|
|
5
|
+
|
|
6
|
+
function buildSilenceKilledResult(silenceTimeoutMs, stdout, signal) {
|
|
7
|
+
return {
|
|
8
|
+
exitCode: 143,
|
|
9
|
+
stdout,
|
|
10
|
+
stderr: `Command killed after ${Number(silenceTimeoutMs)}ms without output`,
|
|
11
|
+
timedOut: true,
|
|
12
|
+
signal: signal || KILL_SIGNAL
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function setupOutputStreaming(subprocess, onOutput, partialOutputFlushMs) {
|
|
17
|
+
const flushMs = Number(partialOutputFlushMs) > 0 ? Number(partialOutputFlushMs) : 2000;
|
|
18
|
+
const streams = {};
|
|
19
|
+
const makeHandler = (stream) => {
|
|
20
|
+
const state = { partial: "", dirty: false };
|
|
21
|
+
streams[stream] = state;
|
|
22
|
+
return (chunk) => {
|
|
23
|
+
state.partial += chunk.toString();
|
|
24
|
+
const lines = state.partial.split(/\r\n|\n|\r/);
|
|
25
|
+
state.partial = lines.pop() ?? "";
|
|
26
|
+
state.dirty = state.partial.length > 0;
|
|
27
|
+
for (const line of lines) {
|
|
28
|
+
if (line) onOutput({ stream, line });
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const flushPartials = () => {
|
|
34
|
+
for (const [stream, state] of Object.entries(streams)) {
|
|
35
|
+
if (!state.dirty || !state.partial) continue;
|
|
36
|
+
onOutput({ stream, line: state.partial });
|
|
37
|
+
state.partial = "";
|
|
38
|
+
state.dirty = false;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
if (subprocess.stdout) subprocess.stdout.on("data", makeHandler("stdout"));
|
|
43
|
+
if (subprocess.stderr) subprocess.stderr.on("data", makeHandler("stderr"));
|
|
44
|
+
const flushInterval = setInterval(flushPartials, flushMs);
|
|
45
|
+
flushInterval.unref?.();
|
|
46
|
+
|
|
47
|
+
subprocess.finally(() => {
|
|
48
|
+
flushPartials();
|
|
49
|
+
clearInterval(flushInterval);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async function awaitWithTimeout(subprocess, timeout, getStdout) {
|
|
54
|
+
let timer = null;
|
|
55
|
+
const timeoutResult = new Promise((resolve) => {
|
|
56
|
+
timer = setTimeout(() => {
|
|
57
|
+
try {
|
|
58
|
+
subprocess.kill(KILL_SIGNAL, { forceKillAfterDelay: 1000 });
|
|
59
|
+
} catch {
|
|
60
|
+
// no-op
|
|
61
|
+
}
|
|
62
|
+
resolve({
|
|
63
|
+
exitCode: 143,
|
|
64
|
+
stdout: getStdout(),
|
|
65
|
+
stderr: `Command timed out after ${timeout}ms`,
|
|
66
|
+
timedOut: true,
|
|
67
|
+
signal: KILL_SIGNAL
|
|
68
|
+
});
|
|
69
|
+
}, timeout);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
const result = await Promise.race([subprocess, timeoutResult]);
|
|
73
|
+
if (timer) clearTimeout(timer);
|
|
74
|
+
return result;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export async function runCommand(command, args = [], options = {}) {
|
|
78
|
+
const { timeout, onOutput, silenceTimeoutMs, partialOutputFlushMs, ...rest } = options;
|
|
79
|
+
// Detach stdin unless the caller provides input (e.g. Codex uses input: prompt).
|
|
80
|
+
// Without this, a subprocess prompting for input hangs forever since there is no TTY.
|
|
81
|
+
if (!rest.stdin && !rest.input) rest.stdin = "ignore";
|
|
82
|
+
const subprocess = execa(command, args, { reject: false, ...rest });
|
|
83
|
+
|
|
84
|
+
let stdoutAccum = "";
|
|
85
|
+
let stderrAccum = "";
|
|
86
|
+
let outputSilenceTimer = null;
|
|
87
|
+
let silenceTimedOut = false;
|
|
88
|
+
|
|
89
|
+
function clearSilenceTimer() {
|
|
90
|
+
if (outputSilenceTimer) {
|
|
91
|
+
clearTimeout(outputSilenceTimer);
|
|
92
|
+
outputSilenceTimer = null;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function armSilenceTimer() {
|
|
97
|
+
const ms = Number(silenceTimeoutMs);
|
|
98
|
+
if (!Number.isFinite(ms) || ms <= 0 || silenceTimedOut) return;
|
|
99
|
+
clearSilenceTimer();
|
|
100
|
+
outputSilenceTimer = setTimeout(() => {
|
|
101
|
+
silenceTimedOut = true;
|
|
102
|
+
try {
|
|
103
|
+
subprocess.kill(KILL_SIGNAL, { forceKillAfterDelay: 1000 });
|
|
104
|
+
} catch {
|
|
105
|
+
// no-op
|
|
106
|
+
}
|
|
107
|
+
}, ms);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (subprocess.stdout) {
|
|
111
|
+
subprocess.stdout.on("data", (chunk) => {
|
|
112
|
+
stdoutAccum += chunk.toString();
|
|
113
|
+
armSilenceTimer();
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
if (subprocess.stderr) {
|
|
117
|
+
subprocess.stderr.on("data", (chunk) => {
|
|
118
|
+
stderrAccum += chunk.toString();
|
|
119
|
+
armSilenceTimer();
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (onOutput) {
|
|
124
|
+
setupOutputStreaming(subprocess, onOutput, partialOutputFlushMs);
|
|
125
|
+
}
|
|
126
|
+
armSilenceTimer();
|
|
127
|
+
|
|
128
|
+
try {
|
|
129
|
+
const result = timeout
|
|
130
|
+
? await awaitWithTimeout(subprocess, timeout, () => stdoutAccum)
|
|
131
|
+
: await subprocess;
|
|
132
|
+
clearSilenceTimer();
|
|
133
|
+
if (silenceTimedOut) return buildSilenceKilledResult(silenceTimeoutMs, stdoutAccum);
|
|
134
|
+
return enrichResult(result, stdoutAccum, stderrAccum);
|
|
135
|
+
} catch (error) {
|
|
136
|
+
clearSilenceTimer();
|
|
137
|
+
if (silenceTimedOut) return buildSilenceKilledResult(silenceTimeoutMs, error?.stdout || stdoutAccum, error?.signal);
|
|
138
|
+
|
|
139
|
+
const details = [error?.shortMessage, error?.originalMessage, error?.stderr, error?.stdout, error?.message]
|
|
140
|
+
.filter(Boolean)
|
|
141
|
+
.join("\n");
|
|
142
|
+
|
|
143
|
+
return {
|
|
144
|
+
exitCode: 1,
|
|
145
|
+
stdout: error?.stdout || stdoutAccum,
|
|
146
|
+
stderr: details || String(error),
|
|
147
|
+
signal: error?.signal || null
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function enrichResult(result, stdoutAccum, _stderrAccum) {
|
|
153
|
+
if (result.timedOut) return result;
|
|
154
|
+
|
|
155
|
+
// execa with reject:false RESOLVES (does not throw) on a spawn
|
|
156
|
+
// failure — ENOENT (binary not in PATH), EACCES, etc. The result
|
|
157
|
+
// then carries exitCode null/undefined, an empty stderr, and the
|
|
158
|
+
// real cause only in `code` / `shortMessage`. Surface it: a missing
|
|
159
|
+
// agent CLI used to fail with a completely empty error message,
|
|
160
|
+
// leaving the user with "coder failed" and no idea what to install.
|
|
161
|
+
if (result.failed && result.exitCode == null && !result.signal) {
|
|
162
|
+
const reason = result.shortMessage || result.message
|
|
163
|
+
|| `spawn failed${result.code ? ` (${result.code})` : ""}`;
|
|
164
|
+
return {
|
|
165
|
+
...result,
|
|
166
|
+
exitCode: 1,
|
|
167
|
+
stdout: result.stdout || stdoutAccum,
|
|
168
|
+
stderr: result.stderr || reason,
|
|
169
|
+
spawnError: result.code || true,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const killed = result.killed || !!result.signal;
|
|
174
|
+
const signal = result.signal || null;
|
|
175
|
+
|
|
176
|
+
if (killed && !result.stderr) {
|
|
177
|
+
return {
|
|
178
|
+
...result,
|
|
179
|
+
stdout: result.stdout || stdoutAccum,
|
|
180
|
+
stderr: signal
|
|
181
|
+
? `Process killed by signal ${signal}`
|
|
182
|
+
: "Process was killed externally",
|
|
183
|
+
signal
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return result;
|
|
188
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run registry — registro persistente de `kj run` activos.
|
|
3
|
+
*
|
|
4
|
+
* KJC-TSK-0396 (extensión): el HU Board necesita ver runs lanzados desde
|
|
5
|
+
* la terminal externa (no solo los lanzados desde el propio board). Para
|
|
6
|
+
* eso, cada `kj run` escribe su PID + planId + huIds + projectDir a un
|
|
7
|
+
* archivo en `~/.karajan/runs/<runId>.json` al arrancar, y lo borra al
|
|
8
|
+
* terminar (success o crash con cleanup vía finally).
|
|
9
|
+
*
|
|
10
|
+
* El board lee ese directorio en startup + cada vez que sirve el endpoint
|
|
11
|
+
* `/api/runs/:planId/active`, descartando los registros con PID muerto
|
|
12
|
+
* (filtrado con `process.kill(pid, 0)`). Resultado: bidireccionalidad
|
|
13
|
+
* total terminal ↔ board.
|
|
14
|
+
*
|
|
15
|
+
* Compartido entre el CLI (src/commands/run.js) y el board
|
|
16
|
+
* (packages/hu-board/src/run-tracker.js) vía `@karajan/core/run-registry`.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import fs from "node:fs";
|
|
20
|
+
import path from "node:path";
|
|
21
|
+
import { writeJsonAtomicSync } from "./atomic-write.js";
|
|
22
|
+
import { getRunsDir } from "./paths.js";
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Directorio raíz donde viven los registros de run.
|
|
26
|
+
* Delega en `getRunsDir()` (KJC-TSK-0420) — respeta KARAJAN_HOME,
|
|
27
|
+
* KJ_HOME (con warning de deprecación), VITEST tmp y default.
|
|
28
|
+
*/
|
|
29
|
+
export function runsDir() {
|
|
30
|
+
return getRunsDir();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Registra un nuevo run en disco. El runId es derivado del PID + timestamp
|
|
35
|
+
* para ser único por proceso.
|
|
36
|
+
*
|
|
37
|
+
* @param {{ pid: number, planId?: string|null, huIds?: string[]|null, projectDir?: string|null, source?: string }} info
|
|
38
|
+
* @returns {string|null} runId o null si la escritura falló (no bloquea al caller).
|
|
39
|
+
*/
|
|
40
|
+
export function registerRun(info = {}) {
|
|
41
|
+
if (!info?.pid) return null;
|
|
42
|
+
try {
|
|
43
|
+
fs.mkdirSync(runsDir(), { recursive: true });
|
|
44
|
+
// Sufijo random para evitar colisiones cuando 2 runs del mismo PID
|
|
45
|
+
// se registran en el mismo ms (raro en CLI, posible en tests).
|
|
46
|
+
const runId = `run-${Date.now()}-${info.pid}-${Math.random().toString(36).slice(2, 8)}`;
|
|
47
|
+
const filePath = path.join(runsDir(), `${runId}.json`);
|
|
48
|
+
const entry = {
|
|
49
|
+
runId,
|
|
50
|
+
pid: info.pid,
|
|
51
|
+
planId: info.planId || null,
|
|
52
|
+
huIds: Array.isArray(info.huIds) ? info.huIds : null,
|
|
53
|
+
projectDir: info.projectDir || null,
|
|
54
|
+
source: info.source || "cli",
|
|
55
|
+
startedAt: new Date().toISOString(),
|
|
56
|
+
};
|
|
57
|
+
writeJsonAtomicSync(filePath, entry);
|
|
58
|
+
return runId;
|
|
59
|
+
} catch {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Borra el registro de un run. Idempotente — silencia ENOENT.
|
|
66
|
+
*
|
|
67
|
+
* @param {string} runId
|
|
68
|
+
*/
|
|
69
|
+
export function unregisterRun(runId) {
|
|
70
|
+
if (!runId) return;
|
|
71
|
+
try {
|
|
72
|
+
fs.unlinkSync(path.join(runsDir(), `${runId}.json`));
|
|
73
|
+
} catch {
|
|
74
|
+
// Idempotente
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Lista todos los runs activos en disco, filtrando los con PID muerto.
|
|
80
|
+
* Los muertos se borran del FS (auto-cleanup defensivo).
|
|
81
|
+
*
|
|
82
|
+
* @param {{ planId?: string }} [filter] - si se pasa planId, devuelve solo los runs de ese plan.
|
|
83
|
+
* @returns {Array<{runId, pid, planId, huIds, projectDir, source, startedAt}>}
|
|
84
|
+
*/
|
|
85
|
+
export function listActiveRuns(filter = {}) {
|
|
86
|
+
const dir = runsDir();
|
|
87
|
+
if (!fs.existsSync(dir)) return [];
|
|
88
|
+
const out = [];
|
|
89
|
+
let files;
|
|
90
|
+
try { files = fs.readdirSync(dir); } catch { return []; }
|
|
91
|
+
for (const f of files) {
|
|
92
|
+
if (!f.endsWith(".json")) continue;
|
|
93
|
+
const filePath = path.join(dir, f);
|
|
94
|
+
let entry;
|
|
95
|
+
try { entry = JSON.parse(fs.readFileSync(filePath, "utf8")); }
|
|
96
|
+
catch { try { fs.unlinkSync(filePath); } catch { /* swallow */ } continue; }
|
|
97
|
+
if (!isAlive(entry.pid)) {
|
|
98
|
+
try { fs.unlinkSync(filePath); } catch { /* swallow */ }
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
if (filter.planId && entry.planId !== filter.planId) continue;
|
|
102
|
+
out.push(entry);
|
|
103
|
+
}
|
|
104
|
+
return out;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Verifica si un PID sigue vivo. `process.kill(pid, 0)` NO envía
|
|
109
|
+
* señal — solo lanza ESRCH si el proceso no existe.
|
|
110
|
+
*/
|
|
111
|
+
function isAlive(pid) {
|
|
112
|
+
if (!pid) return false;
|
|
113
|
+
try { process.kill(pid, 0); return true; }
|
|
114
|
+
catch (err) { return err.code === "EPERM"; }
|
|
115
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Team-shared HU Board paths — KJC-PRP-0002 / v2.31.0 PR1.
|
|
3
|
+
*
|
|
4
|
+
* The shared root lives INSIDE the project, not in `~/.karajan/`, so a team
|
|
5
|
+
* can commit it to git (or sync via Drive/SyncThing) and share plans + HU
|
|
6
|
+
* stories without each member regenerating them locally.
|
|
7
|
+
*
|
|
8
|
+
* <projectDir>/.karajan-shared/
|
|
9
|
+
* plans/<planId>.json ← `kj plan share <planId>` copies here
|
|
10
|
+
* hu-stories/<huId>.md ← reserved for PR2+ (board reads it)
|
|
11
|
+
*
|
|
12
|
+
* Keep the dir name in lockstep with the HU Board sync layer
|
|
13
|
+
* (`packages/hu-board/src/sync.js`) — diverging the constant breaks the
|
|
14
|
+
* watcher silently. One source of truth lives here.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import path from "node:path";
|
|
18
|
+
|
|
19
|
+
export const SHARED_DIR_NAME = ".karajan-shared";
|
|
20
|
+
|
|
21
|
+
export function getSharedRoot(projectDir) {
|
|
22
|
+
return path.join(projectDir, SHARED_DIR_NAME);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function getSharedPlansDir(projectDir) {
|
|
26
|
+
return path.join(getSharedRoot(projectDir), "plans");
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function getSharedHuStoriesDir(projectDir) {
|
|
30
|
+
return path.join(getSharedRoot(projectDir), "hu-stories");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Quick check used by callers that decide whether a plan came from local
|
|
35
|
+
* (`~/.karajan/plans/`) or from the shared dir. The HU Board uses this to
|
|
36
|
+
* stamp a `source` column on each record so the UI can render a 🌐 badge.
|
|
37
|
+
*/
|
|
38
|
+
export function isSharedPath(p) {
|
|
39
|
+
if (!p) return false;
|
|
40
|
+
return p.split(path.sep).includes(SHARED_DIR_NAME);
|
|
41
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// KJC-TSK-0414 PR 1: scheduler event-driven para hibernación.
|
|
2
|
+
//
|
|
3
|
+
// Diseño: setTimeout único por sesión, dispara EXACTAMENTE en cooldownUntil.
|
|
4
|
+
// Cero polling. Si el proceso muere antes del fire, reconcileAll() al
|
|
5
|
+
// arrancar el board re-programa los timeouts pendientes (o reanuda
|
|
6
|
+
// inmediatamente los expirados).
|
|
7
|
+
|
|
8
|
+
import { listPendingStandby, acquireStandbyLock, markStandbyDone } from "./standby-store.js";
|
|
9
|
+
|
|
10
|
+
// Mapa sessionId → NodeJS.Timeout — accesible para test/cancel.
|
|
11
|
+
const _scheduled = new Map();
|
|
12
|
+
|
|
13
|
+
export function _resetScheduledForTests() {
|
|
14
|
+
for (const t of _scheduled.values()) clearTimeout(t);
|
|
15
|
+
_scheduled.clear();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Programa un único setTimeout que dispara `onResume(sessionId)` en cooldownUntil.
|
|
20
|
+
*
|
|
21
|
+
* @param {object} args
|
|
22
|
+
* @param {string} args.sessionId
|
|
23
|
+
* @param {string} args.cooldownUntil - ISO timestamp
|
|
24
|
+
* @param {Function} args.onResume - callback(sessionId) cuando llega el momento
|
|
25
|
+
* @param {object} [args.logger]
|
|
26
|
+
* @returns {{ scheduled: boolean, msUntil?: number, immediate?: boolean }}
|
|
27
|
+
*/
|
|
28
|
+
export function scheduleResume({ sessionId, cooldownUntil, onResume, logger }) {
|
|
29
|
+
if (!sessionId || !cooldownUntil || typeof onResume !== "function") {
|
|
30
|
+
return { scheduled: false };
|
|
31
|
+
}
|
|
32
|
+
cancelScheduled(sessionId);
|
|
33
|
+
const targetMs = new Date(cooldownUntil).getTime();
|
|
34
|
+
if (Number.isNaN(targetMs)) return { scheduled: false };
|
|
35
|
+
const delay = targetMs - Date.now();
|
|
36
|
+
if (delay <= 0) {
|
|
37
|
+
// Ya expiró — reanudar inmediato (caso: board reiniciado tras llegar la hora).
|
|
38
|
+
logger?.info?.(`[standby-scheduler] ${sessionId}: cooldown ya expirado, resume inmediato`);
|
|
39
|
+
Promise.resolve().then(() => onResume(sessionId)).catch(() => { /* swallow */ });
|
|
40
|
+
return { scheduled: true, immediate: true };
|
|
41
|
+
}
|
|
42
|
+
const timer = setTimeout(() => {
|
|
43
|
+
_scheduled.delete(sessionId);
|
|
44
|
+
logger?.info?.(`[standby-scheduler] ${sessionId}: cooldown alcanzado, disparando resume`);
|
|
45
|
+
try { onResume(sessionId); } catch (err) { logger?.warn?.(`[standby-scheduler] onResume threw: ${err.message}`); }
|
|
46
|
+
}, delay);
|
|
47
|
+
if (typeof timer.unref === "function") timer.unref();
|
|
48
|
+
_scheduled.set(sessionId, timer);
|
|
49
|
+
logger?.info?.(`[standby-scheduler] ${sessionId}: scheduled in ${Math.round(delay / 1000)}s (until ${cooldownUntil})`);
|
|
50
|
+
return { scheduled: true, msUntil: delay };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Cancela el setTimeout de una sesión (caso: usuario hizo kj resume manual). */
|
|
54
|
+
export function cancelScheduled(sessionId) {
|
|
55
|
+
const t = _scheduled.get(sessionId);
|
|
56
|
+
if (!t) return false;
|
|
57
|
+
clearTimeout(t);
|
|
58
|
+
_scheduled.delete(sessionId);
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Reconciliación al arrancar el board / kj. Lee todas las sesiones pendientes
|
|
64
|
+
* y para cada una:
|
|
65
|
+
* - cooldownUntil < now → onResume inmediato
|
|
66
|
+
* - cooldownUntil > now → re-programa setTimeout
|
|
67
|
+
*
|
|
68
|
+
* Idempotente: el lockfile en standby-store previene dobles spawns si
|
|
69
|
+
* reconcileAll() corre dos veces concurrentes (board reload).
|
|
70
|
+
*
|
|
71
|
+
* @param {object} args
|
|
72
|
+
* @param {Function} args.onResume - callback(sessionId)
|
|
73
|
+
* @param {object} [args.logger]
|
|
74
|
+
* @returns {{ scheduled: number, immediate: number, total: number }}
|
|
75
|
+
*/
|
|
76
|
+
export function reconcileAll({ onResume, logger }) {
|
|
77
|
+
const sessions = listPendingStandby();
|
|
78
|
+
let scheduled = 0;
|
|
79
|
+
let immediate = 0;
|
|
80
|
+
for (const s of sessions) {
|
|
81
|
+
if (!s?.sessionId || !s?.cooldownUntil) continue;
|
|
82
|
+
const r = scheduleResume({ sessionId: s.sessionId, cooldownUntil: s.cooldownUntil, onResume, logger });
|
|
83
|
+
if (r.scheduled && r.immediate) immediate += 1;
|
|
84
|
+
else if (r.scheduled) scheduled += 1;
|
|
85
|
+
}
|
|
86
|
+
logger?.info?.(`[standby-scheduler] reconcile: ${sessions.length} sesiones (${immediate} resume inmediato, ${scheduled} programadas)`);
|
|
87
|
+
return { scheduled, immediate, total: sessions.length };
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Re-export para que callers no tengan que importar standby-store si solo
|
|
91
|
+
// necesitan el flow scheduler → lock → done.
|
|
92
|
+
export { acquireStandbyLock, markStandbyDone };
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
// KJC-TSK-0414 PR 1: persistencia de sesiones hibernadas al disco.
|
|
2
|
+
//
|
|
3
|
+
// Cuando Brain decide hibernar (QUOTA_EXHAUSTED_DAILY con retryAfter > 5min),
|
|
4
|
+
// serializa el estado completo del run en ~/.kj/standby/<sessionId>.json.
|
|
5
|
+
// El proceso de kj run muere (exit 0) tras persistir; el board (o kj resume)
|
|
6
|
+
// lo reanuda cuando llega cooldownUntil.
|
|
7
|
+
//
|
|
8
|
+
// Layout en disco:
|
|
9
|
+
// ~/.kj/standby/
|
|
10
|
+
// <sessionId>.json ← sesiones pendientes (scheduler les mete setTimeout)
|
|
11
|
+
// <sessionId>.lock ← lockfile durante spawn de kj resume
|
|
12
|
+
// done/
|
|
13
|
+
// <sessionId>.json ← finalizadas (consumibles por GC en TSK-0414 PR3)
|
|
14
|
+
|
|
15
|
+
import fs from "node:fs";
|
|
16
|
+
import path from "node:path";
|
|
17
|
+
import { writeJsonAtomicSync } from "./atomic-write.js";
|
|
18
|
+
import { resolveHome } from "./paths.js";
|
|
19
|
+
|
|
20
|
+
const FILENAME_RE = /^[a-zA-Z0-9._-]+\.json$/;
|
|
21
|
+
|
|
22
|
+
// Delegates to the unified resolver. PR 3 of KJC-PCS-0047 switched
|
|
23
|
+
// the default to `.karajan` — hibernated sessions now persist under
|
|
24
|
+
// `~/.karajan/standby/`, migrated automatically from the legacy
|
|
25
|
+
// `~/.kj/standby/` on the next `kj` invocation.
|
|
26
|
+
function getKjHome() {
|
|
27
|
+
return resolveHome({ defaultSegment: ".karajan" });
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function standbyDir() {
|
|
31
|
+
return path.join(getKjHome(), "standby");
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function standbyDoneDir() {
|
|
35
|
+
return path.join(standbyDir(), "done");
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function sanitizeId(sessionId) {
|
|
39
|
+
if (!sessionId || typeof sessionId !== "string") throw new Error("sessionId requerido");
|
|
40
|
+
return sessionId.replaceAll(/[^a-zA-Z0-9._-]/g, "_").slice(0, 120);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Persiste el estado completo de un run hibernado.
|
|
45
|
+
*
|
|
46
|
+
* @param {object} state - shape:
|
|
47
|
+
* { sessionId, planId?, huId?, role, iteration?, prompt, agentConfig,
|
|
48
|
+
* retryCount?, cooldownUntil, reason, snapshot_sha?, outcome_so_far? }
|
|
49
|
+
* @returns {string} path absoluto del JSON escrito
|
|
50
|
+
*/
|
|
51
|
+
export function persistStandby(state) {
|
|
52
|
+
if (!state || !state.sessionId) throw new Error("state.sessionId requerido");
|
|
53
|
+
if (!state.cooldownUntil) throw new Error("state.cooldownUntil requerido");
|
|
54
|
+
const dir = standbyDir();
|
|
55
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
56
|
+
const file = path.join(dir, `${sanitizeId(state.sessionId)}.json`);
|
|
57
|
+
const payload = {
|
|
58
|
+
...state,
|
|
59
|
+
createdAt: state.createdAt || new Date().toISOString(),
|
|
60
|
+
persistedAt: new Date().toISOString(),
|
|
61
|
+
};
|
|
62
|
+
writeJsonAtomicSync(file, payload);
|
|
63
|
+
return file;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Only these env vars are carried into the standby snapshot. NEVER
|
|
67
|
+
// persist the whole `process.env` — that would leak API keys and other
|
|
68
|
+
// secrets into ~/.kj/standby/*.json. `kj standby resume` re-spawns with
|
|
69
|
+
// the live env merged on top, so the snapshot only needs what is needed
|
|
70
|
+
// to relaunch from the right place.
|
|
71
|
+
const STANDBY_ENV_ALLOWLIST = ["KJ_HOME", "HOME", "PATH"];
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Builds the `sessionState` object that `withBrainRecovery` persists when
|
|
75
|
+
* a run hibernates. Pulls the session id, the relaunch metadata and an
|
|
76
|
+
* allowlisted env subset so `kj standby resume` can re-spawn the command.
|
|
77
|
+
* @param {object} args
|
|
78
|
+
* @param {object} args.session - the pipeline session ({ id, plan_id? })
|
|
79
|
+
* @param {object} [args.config] - resolved config ({ projectDir?, plan? })
|
|
80
|
+
* @param {string|null} [args.huId]
|
|
81
|
+
* @returns {object|null} sessionState, or null when there is no session id
|
|
82
|
+
*/
|
|
83
|
+
export function buildStandbyState({ session, config = {}, huId = null } = {}) {
|
|
84
|
+
if (!session?.id) return null;
|
|
85
|
+
const env = {};
|
|
86
|
+
for (const key of STANDBY_ENV_ALLOWLIST) {
|
|
87
|
+
if (process.env[key] != null) env[key] = process.env[key];
|
|
88
|
+
}
|
|
89
|
+
for (const [key, value] of Object.entries(process.env)) {
|
|
90
|
+
if (key.startsWith("KJ_") && value != null) env[key] = value;
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
sessionId: session.id,
|
|
94
|
+
planId: session.plan_id || config.plan || null,
|
|
95
|
+
huId: huId || null,
|
|
96
|
+
argv: process.argv.slice(2),
|
|
97
|
+
cwd: config.projectDir || process.cwd(),
|
|
98
|
+
env,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* @param {string} sessionId
|
|
104
|
+
* @returns {object|null}
|
|
105
|
+
*/
|
|
106
|
+
export function loadStandby(sessionId) {
|
|
107
|
+
const file = path.join(standbyDir(), `${sanitizeId(sessionId)}.json`);
|
|
108
|
+
if (!fs.existsSync(file)) return null;
|
|
109
|
+
try {
|
|
110
|
+
return JSON.parse(fs.readFileSync(file, "utf-8"));
|
|
111
|
+
} catch {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Lista todas las sesiones pendientes (no las de done/).
|
|
118
|
+
* @returns {object[]}
|
|
119
|
+
*/
|
|
120
|
+
export function listPendingStandby() {
|
|
121
|
+
const dir = standbyDir();
|
|
122
|
+
if (!fs.existsSync(dir)) return [];
|
|
123
|
+
return fs.readdirSync(dir)
|
|
124
|
+
.filter((f) => FILENAME_RE.test(f))
|
|
125
|
+
.map((f) => {
|
|
126
|
+
try {
|
|
127
|
+
return JSON.parse(fs.readFileSync(path.join(dir, f), "utf-8"));
|
|
128
|
+
} catch {
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
})
|
|
132
|
+
.filter(Boolean);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Mueve una sesión a done/ — consumible por GC en TSK-0414 PR3.
|
|
137
|
+
* @param {string} sessionId
|
|
138
|
+
* @returns {boolean} true si se movió
|
|
139
|
+
*/
|
|
140
|
+
export function markStandbyDone(sessionId) {
|
|
141
|
+
const id = sanitizeId(sessionId);
|
|
142
|
+
const src = path.join(standbyDir(), `${id}.json`);
|
|
143
|
+
if (!fs.existsSync(src)) return false;
|
|
144
|
+
const doneDir = standbyDoneDir();
|
|
145
|
+
fs.mkdirSync(doneDir, { recursive: true });
|
|
146
|
+
const dst = path.join(doneDir, `${id}-${Date.now()}.json`);
|
|
147
|
+
fs.renameSync(src, dst);
|
|
148
|
+
return true;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Lockfile para evitar dobles spawns de kj resume sobre la misma sesión.
|
|
153
|
+
* Devuelve { acquired: true, release: () => void } o { acquired: false } si ya hay lock.
|
|
154
|
+
*
|
|
155
|
+
* @param {string} sessionId
|
|
156
|
+
* @returns {{ acquired: boolean, release?: Function }}
|
|
157
|
+
*/
|
|
158
|
+
export function acquireStandbyLock(sessionId) {
|
|
159
|
+
const id = sanitizeId(sessionId);
|
|
160
|
+
const lockFile = path.join(standbyDir(), `${id}.lock`);
|
|
161
|
+
try {
|
|
162
|
+
fs.mkdirSync(standbyDir(), { recursive: true });
|
|
163
|
+
fs.writeFileSync(lockFile, String(process.pid), { flag: "wx" });
|
|
164
|
+
return { acquired: true, release: () => { try { fs.unlinkSync(lockFile); } catch { /* */ } } };
|
|
165
|
+
} catch {
|
|
166
|
+
return { acquired: false };
|
|
167
|
+
}
|
|
168
|
+
}
|