@schema-weaver/pg-connector 0.0.0-stage → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/LICENSE +21 -0
- package/README.md +457 -2
- package/dist/cjs/audit/chain.d.ts +365 -0
- package/dist/cjs/audit/chain.d.ts.map +1 -0
- package/dist/cjs/audit/chain.js +959 -0
- package/dist/cjs/audit/chain.js.map +1 -0
- package/dist/cjs/audit/cloud-client.d.ts +142 -0
- package/dist/cjs/audit/cloud-client.d.ts.map +1 -0
- package/dist/cjs/audit/cloud-client.js +364 -0
- package/dist/cjs/audit/cloud-client.js.map +1 -0
- package/dist/cjs/audit/cloud-writer.d.ts +57 -0
- package/dist/cjs/audit/cloud-writer.d.ts.map +1 -0
- package/dist/cjs/audit/cloud-writer.js +95 -0
- package/dist/cjs/audit/cloud-writer.js.map +1 -0
- package/dist/cjs/audit/context.d.ts +51 -0
- package/dist/cjs/audit/context.d.ts.map +1 -0
- package/dist/cjs/audit/context.js +75 -0
- package/dist/cjs/audit/context.js.map +1 -0
- package/dist/cjs/audit/files.d.ts +111 -0
- package/dist/cjs/audit/files.d.ts.map +1 -0
- package/dist/cjs/audit/files.js +406 -0
- package/dist/cjs/audit/files.js.map +1 -0
- package/dist/cjs/audit/index.d.ts +9 -0
- package/dist/cjs/audit/index.d.ts.map +1 -0
- package/dist/cjs/audit/index.js +68 -0
- package/dist/cjs/audit/index.js.map +1 -0
- package/dist/cjs/audit/local-writer.d.ts +255 -0
- package/dist/cjs/audit/local-writer.d.ts.map +1 -0
- package/dist/cjs/audit/local-writer.js +829 -0
- package/dist/cjs/audit/local-writer.js.map +1 -0
- package/dist/cjs/audit/redact.d.ts +151 -0
- package/dist/cjs/audit/redact.d.ts.map +1 -0
- package/dist/cjs/audit/redact.js +549 -0
- package/dist/cjs/audit/redact.js.map +1 -0
- package/dist/cjs/audit/sanitize.d.ts +78 -0
- package/dist/cjs/audit/sanitize.d.ts.map +1 -0
- package/dist/cjs/audit/sanitize.js +315 -0
- package/dist/cjs/audit/sanitize.js.map +1 -0
- package/dist/cjs/audit/sink.d.ts +278 -0
- package/dist/cjs/audit/sink.d.ts.map +1 -0
- package/dist/cjs/audit/sink.js +819 -0
- package/dist/cjs/audit/sink.js.map +1 -0
- package/dist/cjs/audit/types.d.ts +226 -0
- package/dist/cjs/audit/types.d.ts.map +1 -0
- package/dist/cjs/audit/types.js +3 -0
- package/dist/cjs/audit/types.js.map +1 -0
- package/dist/cjs/audit/verify-cache.d.ts +127 -0
- package/dist/cjs/audit/verify-cache.d.ts.map +1 -0
- package/dist/cjs/audit/verify-cache.js +668 -0
- package/dist/cjs/audit/verify-cache.js.map +1 -0
- package/dist/cjs/channels/agent-session.d.ts +228 -0
- package/dist/cjs/channels/agent-session.d.ts.map +1 -0
- package/dist/cjs/channels/agent-session.js +604 -0
- package/dist/cjs/channels/agent-session.js.map +1 -0
- package/dist/cjs/channels/data-channel.d.ts +181 -0
- package/dist/cjs/channels/data-channel.d.ts.map +1 -0
- package/dist/cjs/channels/data-channel.js +607 -0
- package/dist/cjs/channels/data-channel.js.map +1 -0
- package/dist/cjs/channels/reconnect.d.ts +142 -0
- package/dist/cjs/channels/reconnect.d.ts.map +1 -0
- package/dist/cjs/channels/reconnect.js +247 -0
- package/dist/cjs/channels/reconnect.js.map +1 -0
- package/dist/cjs/channels/types.d.ts +112 -0
- package/dist/cjs/channels/types.d.ts.map +1 -0
- package/dist/cjs/channels/types.js +3 -0
- package/dist/cjs/channels/types.js.map +1 -0
- package/dist/cjs/channels/wake-channel.d.ts +232 -0
- package/dist/cjs/channels/wake-channel.d.ts.map +1 -0
- package/dist/cjs/channels/wake-channel.js +752 -0
- package/dist/cjs/channels/wake-channel.js.map +1 -0
- package/dist/cjs/cli/banner.d.ts +2 -0
- package/dist/cjs/cli/banner.d.ts.map +1 -0
- package/dist/cjs/cli/banner.js +150 -0
- package/dist/cjs/cli/banner.js.map +1 -0
- package/dist/cjs/cli/commands/agent.d.ts +30 -0
- package/dist/cjs/cli/commands/agent.d.ts.map +1 -0
- package/dist/cjs/cli/commands/agent.js +214 -0
- package/dist/cjs/cli/commands/agent.js.map +1 -0
- package/dist/cjs/cli/commands/audit-verify.d.ts +19 -0
- package/dist/cjs/cli/commands/audit-verify.d.ts.map +1 -0
- package/dist/cjs/cli/commands/audit-verify.js +382 -0
- package/dist/cjs/cli/commands/audit-verify.js.map +1 -0
- package/dist/cjs/cli/commands/clean.d.ts +23 -0
- package/dist/cjs/cli/commands/clean.d.ts.map +1 -0
- package/dist/cjs/cli/commands/clean.js +272 -0
- package/dist/cjs/cli/commands/clean.js.map +1 -0
- package/dist/cjs/cli/commands/config-show.d.ts +2 -0
- package/dist/cjs/cli/commands/config-show.d.ts.map +1 -0
- package/dist/cjs/cli/commands/config-show.js +10 -0
- package/dist/cjs/cli/commands/config-show.js.map +1 -0
- package/dist/cjs/cli/commands/config.d.ts +6 -0
- package/dist/cjs/cli/commands/config.d.ts.map +1 -0
- package/dist/cjs/cli/commands/config.js +266 -0
- package/dist/cjs/cli/commands/config.js.map +1 -0
- package/dist/cjs/cli/commands/db-add.d.ts +16 -0
- package/dist/cjs/cli/commands/db-add.d.ts.map +1 -0
- package/dist/cjs/cli/commands/db-add.js +613 -0
- package/dist/cjs/cli/commands/db-add.js.map +1 -0
- package/dist/cjs/cli/commands/db-edit.d.ts +2 -0
- package/dist/cjs/cli/commands/db-edit.d.ts.map +1 -0
- package/dist/cjs/cli/commands/db-edit.js +388 -0
- package/dist/cjs/cli/commands/db-edit.js.map +1 -0
- package/dist/cjs/cli/commands/db-logs.d.ts +3 -0
- package/dist/cjs/cli/commands/db-logs.d.ts.map +1 -0
- package/dist/cjs/cli/commands/db-logs.js +67 -0
- package/dist/cjs/cli/commands/db-logs.js.map +1 -0
- package/dist/cjs/cli/commands/db-ls.d.ts +2 -0
- package/dist/cjs/cli/commands/db-ls.d.ts.map +1 -0
- package/dist/cjs/cli/commands/db-ls.js +118 -0
- package/dist/cjs/cli/commands/db-ls.js.map +1 -0
- package/dist/cjs/cli/commands/db-query.d.ts +121 -0
- package/dist/cjs/cli/commands/db-query.d.ts.map +1 -0
- package/dist/cjs/cli/commands/db-query.js +802 -0
- package/dist/cjs/cli/commands/db-query.js.map +1 -0
- package/dist/cjs/cli/commands/db-remove.d.ts +2 -0
- package/dist/cjs/cli/commands/db-remove.d.ts.map +1 -0
- package/dist/cjs/cli/commands/db-remove.js +51 -0
- package/dist/cjs/cli/commands/db-remove.js.map +1 -0
- package/dist/cjs/cli/commands/db-show.d.ts +2 -0
- package/dist/cjs/cli/commands/db-show.d.ts.map +1 -0
- package/dist/cjs/cli/commands/db-show.js +134 -0
- package/dist/cjs/cli/commands/db-show.js.map +1 -0
- package/dist/cjs/cli/commands/db-test.d.ts +3 -0
- package/dist/cjs/cli/commands/db-test.d.ts.map +1 -0
- package/dist/cjs/cli/commands/db-test.js +311 -0
- package/dist/cjs/cli/commands/db-test.js.map +1 -0
- package/dist/cjs/cli/commands/db.d.ts +11 -0
- package/dist/cjs/cli/commands/db.d.ts.map +1 -0
- package/dist/cjs/cli/commands/db.js +90 -0
- package/dist/cjs/cli/commands/db.js.map +1 -0
- package/dist/cjs/cli/commands/debug.d.ts +2 -0
- package/dist/cjs/cli/commands/debug.d.ts.map +1 -0
- package/dist/cjs/cli/commands/debug.js +241 -0
- package/dist/cjs/cli/commands/debug.js.map +1 -0
- package/dist/cjs/cli/commands/doctor.d.ts +5 -0
- package/dist/cjs/cli/commands/doctor.d.ts.map +1 -0
- package/dist/cjs/cli/commands/doctor.js +117 -0
- package/dist/cjs/cli/commands/doctor.js.map +1 -0
- package/dist/cjs/cli/commands/index.d.ts +10 -0
- package/dist/cjs/cli/commands/index.d.ts.map +1 -0
- package/dist/cjs/cli/commands/index.js +30 -0
- package/dist/cjs/cli/commands/index.js.map +1 -0
- package/dist/cjs/cli/commands/init.d.ts +2 -0
- package/dist/cjs/cli/commands/init.d.ts.map +1 -0
- package/dist/cjs/cli/commands/init.js +199 -0
- package/dist/cjs/cli/commands/init.js.map +1 -0
- package/dist/cjs/cli/commands/link.d.ts +5 -0
- package/dist/cjs/cli/commands/link.d.ts.map +1 -0
- package/dist/cjs/cli/commands/link.js +44 -0
- package/dist/cjs/cli/commands/link.js.map +1 -0
- package/dist/cjs/cli/commands/logs.d.ts +17 -0
- package/dist/cjs/cli/commands/logs.d.ts.map +1 -0
- package/dist/cjs/cli/commands/logs.js +314 -0
- package/dist/cjs/cli/commands/logs.js.map +1 -0
- package/dist/cjs/cli/commands/project-show.d.ts +2 -0
- package/dist/cjs/cli/commands/project-show.d.ts.map +1 -0
- package/dist/cjs/cli/commands/project-show.js +105 -0
- package/dist/cjs/cli/commands/project-show.js.map +1 -0
- package/dist/cjs/cli/commands/project.d.ts +3 -0
- package/dist/cjs/cli/commands/project.d.ts.map +1 -0
- package/dist/cjs/cli/commands/project.js +64 -0
- package/dist/cjs/cli/commands/project.js.map +1 -0
- package/dist/cjs/cli/commands/service.d.ts +123 -0
- package/dist/cjs/cli/commands/service.d.ts.map +1 -0
- package/dist/cjs/cli/commands/service.js +554 -0
- package/dist/cjs/cli/commands/service.js.map +1 -0
- package/dist/cjs/cli/commands/start.d.ts +6 -0
- package/dist/cjs/cli/commands/start.d.ts.map +1 -0
- package/dist/cjs/cli/commands/start.js +308 -0
- package/dist/cjs/cli/commands/start.js.map +1 -0
- package/dist/cjs/cli/commands/status.d.ts +2 -0
- package/dist/cjs/cli/commands/status.d.ts.map +1 -0
- package/dist/cjs/cli/commands/status.js +225 -0
- package/dist/cjs/cli/commands/status.js.map +1 -0
- package/dist/cjs/cli/commands/stop.d.ts +6 -0
- package/dist/cjs/cli/commands/stop.d.ts.map +1 -0
- package/dist/cjs/cli/commands/stop.js +99 -0
- package/dist/cjs/cli/commands/stop.js.map +1 -0
- package/dist/cjs/cli/daemon/error-tracker.d.ts +119 -0
- package/dist/cjs/cli/daemon/error-tracker.d.ts.map +1 -0
- package/dist/cjs/cli/daemon/error-tracker.js +500 -0
- package/dist/cjs/cli/daemon/error-tracker.js.map +1 -0
- package/dist/cjs/cli/daemon/fault-shutdown.d.ts +144 -0
- package/dist/cjs/cli/daemon/fault-shutdown.d.ts.map +1 -0
- package/dist/cjs/cli/daemon/fault-shutdown.js +312 -0
- package/dist/cjs/cli/daemon/fault-shutdown.js.map +1 -0
- package/dist/cjs/cli/daemon/index.d.ts +12 -0
- package/dist/cjs/cli/daemon/index.d.ts.map +1 -0
- package/dist/cjs/cli/daemon/index.js +23 -0
- package/dist/cjs/cli/daemon/index.js.map +1 -0
- package/dist/cjs/cli/daemon/pid-file.d.ts +13 -0
- package/dist/cjs/cli/daemon/pid-file.d.ts.map +1 -0
- package/dist/cjs/cli/daemon/pid-file.js +90 -0
- package/dist/cjs/cli/daemon/pid-file.js.map +1 -0
- package/dist/cjs/cli/daemon/readiness.d.ts +30 -0
- package/dist/cjs/cli/daemon/readiness.d.ts.map +1 -0
- package/dist/cjs/cli/daemon/readiness.js +74 -0
- package/dist/cjs/cli/daemon/readiness.js.map +1 -0
- package/dist/cjs/cli/daemon/runtime.d.ts +366 -0
- package/dist/cjs/cli/daemon/runtime.d.ts.map +1 -0
- package/dist/cjs/cli/daemon/runtime.js +1343 -0
- package/dist/cjs/cli/daemon/runtime.js.map +1 -0
- package/dist/cjs/cli/daemon/shutdown.d.ts +7 -0
- package/dist/cjs/cli/daemon/shutdown.d.ts.map +1 -0
- package/dist/cjs/cli/daemon/shutdown.js +66 -0
- package/dist/cjs/cli/daemon/shutdown.js.map +1 -0
- package/dist/cjs/cli/daemon/signal-handlers.d.ts +3 -0
- package/dist/cjs/cli/daemon/signal-handlers.d.ts.map +1 -0
- package/dist/cjs/cli/daemon/signal-handlers.js +27 -0
- package/dist/cjs/cli/daemon/signal-handlers.js.map +1 -0
- package/dist/cjs/cli/daemon/state.d.ts +157 -0
- package/dist/cjs/cli/daemon/state.d.ts.map +1 -0
- package/dist/cjs/cli/daemon/state.js +397 -0
- package/dist/cjs/cli/daemon/state.js.map +1 -0
- package/dist/cjs/cli/daemon/status-file.d.ts +139 -0
- package/dist/cjs/cli/daemon/status-file.d.ts.map +1 -0
- package/dist/cjs/cli/daemon/status-file.js +88 -0
- package/dist/cjs/cli/daemon/status-file.js.map +1 -0
- package/dist/cjs/cli/doctor/checks.d.ts +133 -0
- package/dist/cjs/cli/doctor/checks.d.ts.map +1 -0
- package/dist/cjs/cli/doctor/checks.js +677 -0
- package/dist/cjs/cli/doctor/checks.js.map +1 -0
- package/dist/cjs/cli/doctor/fixes.d.ts +9 -0
- package/dist/cjs/cli/doctor/fixes.d.ts.map +1 -0
- package/dist/cjs/cli/doctor/fixes.js +199 -0
- package/dist/cjs/cli/doctor/fixes.js.map +1 -0
- package/dist/cjs/cli/doctor/index.d.ts +7 -0
- package/dist/cjs/cli/doctor/index.d.ts.map +1 -0
- package/dist/cjs/cli/doctor/index.js +27 -0
- package/dist/cjs/cli/doctor/index.js.map +1 -0
- package/dist/cjs/cli/index.d.ts +3 -0
- package/dist/cjs/cli/index.d.ts.map +1 -0
- package/dist/cjs/cli/index.js +336 -0
- package/dist/cjs/cli/index.js.map +1 -0
- package/dist/cjs/cli/interactive.d.ts +8 -0
- package/dist/cjs/cli/interactive.d.ts.map +1 -0
- package/dist/cjs/cli/interactive.js +670 -0
- package/dist/cjs/cli/interactive.js.map +1 -0
- package/dist/cjs/cli/logs/format.d.ts +13 -0
- package/dist/cjs/cli/logs/format.d.ts.map +1 -0
- package/dist/cjs/cli/logs/format.js +178 -0
- package/dist/cjs/cli/logs/format.js.map +1 -0
- package/dist/cjs/cli/logs/index.d.ts +3 -0
- package/dist/cjs/cli/logs/index.d.ts.map +1 -0
- package/dist/cjs/cli/logs/index.js +13 -0
- package/dist/cjs/cli/logs/index.js.map +1 -0
- package/dist/cjs/cli/logs/viewer.d.ts +41 -0
- package/dist/cjs/cli/logs/viewer.d.ts.map +1 -0
- package/dist/cjs/cli/logs/viewer.js +417 -0
- package/dist/cjs/cli/logs/viewer.js.map +1 -0
- package/dist/cjs/cli/ops/operation-logger.d.ts +63 -0
- package/dist/cjs/cli/ops/operation-logger.d.ts.map +1 -0
- package/dist/cjs/cli/ops/operation-logger.js +183 -0
- package/dist/cjs/cli/ops/operation-logger.js.map +1 -0
- package/dist/cjs/cli/palette.d.ts +11 -0
- package/dist/cjs/cli/palette.d.ts.map +1 -0
- package/dist/cjs/cli/palette.js +243 -0
- package/dist/cjs/cli/palette.js.map +1 -0
- package/dist/cjs/cli/prompt.d.ts +186 -0
- package/dist/cjs/cli/prompt.d.ts.map +1 -0
- package/dist/cjs/cli/prompt.js +541 -0
- package/dist/cjs/cli/prompt.js.map +1 -0
- package/dist/cjs/cli/ui/box.d.ts +21 -0
- package/dist/cjs/cli/ui/box.d.ts.map +1 -0
- package/dist/cjs/cli/ui/box.js +72 -0
- package/dist/cjs/cli/ui/box.js.map +1 -0
- package/dist/cjs/cli/ui/clipboard.d.ts +6 -0
- package/dist/cjs/cli/ui/clipboard.d.ts.map +1 -0
- package/dist/cjs/cli/ui/clipboard.js +78 -0
- package/dist/cjs/cli/ui/clipboard.js.map +1 -0
- package/dist/cjs/cli/ui/colors.d.ts +57 -0
- package/dist/cjs/cli/ui/colors.d.ts.map +1 -0
- package/dist/cjs/cli/ui/colors.js +151 -0
- package/dist/cjs/cli/ui/colors.js.map +1 -0
- package/dist/cjs/cli/ui/index.d.ts +9 -0
- package/dist/cjs/cli/ui/index.d.ts.map +1 -0
- package/dist/cjs/cli/ui/index.js +55 -0
- package/dist/cjs/cli/ui/index.js.map +1 -0
- package/dist/cjs/cli/ui/spinner.d.ts +12 -0
- package/dist/cjs/cli/ui/spinner.d.ts.map +1 -0
- package/dist/cjs/cli/ui/spinner.js +82 -0
- package/dist/cjs/cli/ui/spinner.js.map +1 -0
- package/dist/cjs/cli/ui/symbols.d.ts +47 -0
- package/dist/cjs/cli/ui/symbols.d.ts.map +1 -0
- package/dist/cjs/cli/ui/symbols.js +112 -0
- package/dist/cjs/cli/ui/symbols.js.map +1 -0
- package/dist/cjs/cli/ui/table.d.ts +23 -0
- package/dist/cjs/cli/ui/table.d.ts.map +1 -0
- package/dist/cjs/cli/ui/table.js +160 -0
- package/dist/cjs/cli/ui/table.js.map +1 -0
- package/dist/cjs/cli/ui/terminal.d.ts +7 -0
- package/dist/cjs/cli/ui/terminal.d.ts.map +1 -0
- package/dist/cjs/cli/ui/terminal.js +40 -0
- package/dist/cjs/cli/ui/terminal.js.map +1 -0
- package/dist/cjs/config/atomic-write.d.ts +69 -0
- package/dist/cjs/config/atomic-write.d.ts.map +1 -0
- package/dist/cjs/config/atomic-write.js +289 -0
- package/dist/cjs/config/atomic-write.js.map +1 -0
- package/dist/cjs/config/db-config.d.ts +134 -0
- package/dist/cjs/config/db-config.d.ts.map +1 -0
- package/dist/cjs/config/db-config.js +594 -0
- package/dist/cjs/config/db-config.js.map +1 -0
- package/dist/cjs/config/machine-config.d.ts +85 -0
- package/dist/cjs/config/machine-config.d.ts.map +1 -0
- package/dist/cjs/config/machine-config.js +232 -0
- package/dist/cjs/config/machine-config.js.map +1 -0
- package/dist/cjs/config/paths.d.ts +64 -0
- package/dist/cjs/config/paths.d.ts.map +1 -0
- package/dist/cjs/config/paths.js +155 -0
- package/dist/cjs/config/paths.js.map +1 -0
- package/dist/cjs/config/schema.d.ts +72 -0
- package/dist/cjs/config/schema.d.ts.map +1 -0
- package/dist/cjs/config/schema.js +197 -0
- package/dist/cjs/config/schema.js.map +1 -0
- package/dist/cjs/config/token.d.ts +63 -0
- package/dist/cjs/config/token.d.ts.map +1 -0
- package/dist/cjs/config/token.js +146 -0
- package/dist/cjs/config/token.js.map +1 -0
- package/dist/cjs/execution/canceller.d.ts +41 -0
- package/dist/cjs/execution/canceller.d.ts.map +1 -0
- package/dist/cjs/execution/canceller.js +209 -0
- package/dist/cjs/execution/canceller.js.map +1 -0
- package/dist/cjs/execution/database-lookup.d.ts +56 -0
- package/dist/cjs/execution/database-lookup.d.ts.map +1 -0
- package/dist/cjs/execution/database-lookup.js +43 -0
- package/dist/cjs/execution/database-lookup.js.map +1 -0
- package/dist/cjs/execution/dispatcher.d.ts +181 -0
- package/dist/cjs/execution/dispatcher.d.ts.map +1 -0
- package/dist/cjs/execution/dispatcher.js +1296 -0
- package/dist/cjs/execution/dispatcher.js.map +1 -0
- package/dist/cjs/execution/function-effects.d.ts +209 -0
- package/dist/cjs/execution/function-effects.d.ts.map +1 -0
- package/dist/cjs/execution/function-effects.js +596 -0
- package/dist/cjs/execution/function-effects.js.map +1 -0
- package/dist/cjs/execution/introspection.d.ts +76 -0
- package/dist/cjs/execution/introspection.d.ts.map +1 -0
- package/dist/cjs/execution/introspection.js +448 -0
- package/dist/cjs/execution/introspection.js.map +1 -0
- package/dist/cjs/execution/migration-runner.d.ts +128 -0
- package/dist/cjs/execution/migration-runner.d.ts.map +1 -0
- package/dist/cjs/execution/migration-runner.js +798 -0
- package/dist/cjs/execution/migration-runner.js.map +1 -0
- package/dist/cjs/execution/non-tx-detector.d.ts +23 -0
- package/dist/cjs/execution/non-tx-detector.d.ts.map +1 -0
- package/dist/cjs/execution/non-tx-detector.js +218 -0
- package/dist/cjs/execution/non-tx-detector.js.map +1 -0
- package/dist/cjs/execution/pool.d.ts +229 -0
- package/dist/cjs/execution/pool.d.ts.map +1 -0
- package/dist/cjs/execution/pool.js +738 -0
- package/dist/cjs/execution/pool.js.map +1 -0
- package/dist/cjs/execution/query-runner.d.ts +88 -0
- package/dist/cjs/execution/query-runner.d.ts.map +1 -0
- package/dist/cjs/execution/query-runner.js +751 -0
- package/dist/cjs/execution/query-runner.js.map +1 -0
- package/dist/cjs/execution/rate-limiter.d.ts +120 -0
- package/dist/cjs/execution/rate-limiter.d.ts.map +1 -0
- package/dist/cjs/execution/rate-limiter.js +273 -0
- package/dist/cjs/execution/rate-limiter.js.map +1 -0
- package/dist/cjs/execution/search-path.d.ts +161 -0
- package/dist/cjs/execution/search-path.d.ts.map +1 -0
- package/dist/cjs/execution/search-path.js +279 -0
- package/dist/cjs/execution/search-path.js.map +1 -0
- package/dist/cjs/execution/sql-parser.d.ts +195 -0
- package/dist/cjs/execution/sql-parser.d.ts.map +1 -0
- package/dist/cjs/execution/sql-parser.js +704 -0
- package/dist/cjs/execution/sql-parser.js.map +1 -0
- package/dist/cjs/execution/statement-classifier.d.ts +103 -0
- package/dist/cjs/execution/statement-classifier.d.ts.map +1 -0
- package/dist/cjs/execution/statement-classifier.js +535 -0
- package/dist/cjs/execution/statement-classifier.js.map +1 -0
- package/dist/cjs/execution/types.d.ts +189 -0
- package/dist/cjs/execution/types.d.ts.map +1 -0
- package/dist/cjs/execution/types.js +28 -0
- package/dist/cjs/execution/types.js.map +1 -0
- package/dist/cjs/index.d.ts +34 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +98 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/permissions/auto-upgrade.d.ts +40 -0
- package/dist/cjs/permissions/auto-upgrade.d.ts.map +1 -0
- package/dist/cjs/permissions/auto-upgrade.js +168 -0
- package/dist/cjs/permissions/auto-upgrade.js.map +1 -0
- package/dist/cjs/permissions/checker.d.ts +53 -0
- package/dist/cjs/permissions/checker.d.ts.map +1 -0
- package/dist/cjs/permissions/checker.js +326 -0
- package/dist/cjs/permissions/checker.js.map +1 -0
- package/dist/cjs/permissions/manual-approval.d.ts +213 -0
- package/dist/cjs/permissions/manual-approval.d.ts.map +1 -0
- package/dist/cjs/permissions/manual-approval.js +541 -0
- package/dist/cjs/permissions/manual-approval.js.map +1 -0
- package/dist/cjs/permissions/plan-registry.d.ts +274 -0
- package/dist/cjs/permissions/plan-registry.d.ts.map +1 -0
- package/dist/cjs/permissions/plan-registry.js +454 -0
- package/dist/cjs/permissions/plan-registry.js.map +1 -0
- package/dist/cjs/permissions/role-policy.d.ts +217 -0
- package/dist/cjs/permissions/role-policy.d.ts.map +1 -0
- package/dist/cjs/permissions/role-policy.js +584 -0
- package/dist/cjs/permissions/role-policy.js.map +1 -0
- package/dist/cjs/permissions/types.d.ts +126 -0
- package/dist/cjs/permissions/types.d.ts.map +1 -0
- package/dist/cjs/permissions/types.js +3 -0
- package/dist/cjs/permissions/types.js.map +1 -0
- package/dist/cjs/protocol/constants.d.ts +72 -0
- package/dist/cjs/protocol/constants.d.ts.map +1 -0
- package/dist/cjs/protocol/constants.js +107 -0
- package/dist/cjs/protocol/constants.js.map +1 -0
- package/dist/cjs/protocol/envelope.d.ts +165 -0
- package/dist/cjs/protocol/envelope.d.ts.map +1 -0
- package/dist/cjs/protocol/envelope.js +309 -0
- package/dist/cjs/protocol/envelope.js.map +1 -0
- package/dist/cjs/protocol/errors.d.ts +33 -0
- package/dist/cjs/protocol/errors.d.ts.map +1 -0
- package/dist/cjs/protocol/errors.js +391 -0
- package/dist/cjs/protocol/errors.js.map +1 -0
- package/dist/cjs/protocol/messages.d.ts +327 -0
- package/dist/cjs/protocol/messages.d.ts.map +1 -0
- package/dist/cjs/protocol/messages.js +3 -0
- package/dist/cjs/protocol/messages.js.map +1 -0
- package/dist/cjs/protocol/serialize.d.ts +26 -0
- package/dist/cjs/protocol/serialize.d.ts.map +1 -0
- package/dist/cjs/protocol/serialize.js +71 -0
- package/dist/cjs/protocol/serialize.js.map +1 -0
- package/dist/cjs/protocol/validate.d.ts +135 -0
- package/dist/cjs/protocol/validate.d.ts.map +1 -0
- package/dist/cjs/protocol/validate.js +852 -0
- package/dist/cjs/protocol/validate.js.map +1 -0
- package/dist/esm/audit/chain.d.ts +365 -0
- package/dist/esm/audit/chain.d.ts.map +1 -0
- package/dist/esm/audit/chain.js +895 -0
- package/dist/esm/audit/chain.js.map +1 -0
- package/dist/esm/audit/cloud-client.d.ts +142 -0
- package/dist/esm/audit/cloud-client.d.ts.map +1 -0
- package/dist/esm/audit/cloud-client.js +326 -0
- package/dist/esm/audit/cloud-client.js.map +1 -0
- package/dist/esm/audit/cloud-writer.d.ts +57 -0
- package/dist/esm/audit/cloud-writer.d.ts.map +1 -0
- package/dist/esm/audit/cloud-writer.js +91 -0
- package/dist/esm/audit/cloud-writer.js.map +1 -0
- package/dist/esm/audit/context.d.ts +51 -0
- package/dist/esm/audit/context.d.ts.map +1 -0
- package/dist/esm/audit/context.js +69 -0
- package/dist/esm/audit/context.js.map +1 -0
- package/dist/esm/audit/files.d.ts +111 -0
- package/dist/esm/audit/files.d.ts.map +1 -0
- package/dist/esm/audit/files.js +361 -0
- package/dist/esm/audit/files.js.map +1 -0
- package/dist/esm/audit/index.d.ts +9 -0
- package/dist/esm/audit/index.d.ts.map +1 -0
- package/dist/esm/audit/index.js +8 -0
- package/dist/esm/audit/index.js.map +1 -0
- package/dist/esm/audit/local-writer.d.ts +255 -0
- package/dist/esm/audit/local-writer.d.ts.map +1 -0
- package/dist/esm/audit/local-writer.js +785 -0
- package/dist/esm/audit/local-writer.js.map +1 -0
- package/dist/esm/audit/redact.d.ts +151 -0
- package/dist/esm/audit/redact.d.ts.map +1 -0
- package/dist/esm/audit/redact.js +506 -0
- package/dist/esm/audit/redact.js.map +1 -0
- package/dist/esm/audit/sanitize.d.ts +78 -0
- package/dist/esm/audit/sanitize.d.ts.map +1 -0
- package/dist/esm/audit/sanitize.js +307 -0
- package/dist/esm/audit/sanitize.js.map +1 -0
- package/dist/esm/audit/sink.d.ts +278 -0
- package/dist/esm/audit/sink.d.ts.map +1 -0
- package/dist/esm/audit/sink.js +782 -0
- package/dist/esm/audit/sink.js.map +1 -0
- package/dist/esm/audit/types.d.ts +226 -0
- package/dist/esm/audit/types.d.ts.map +1 -0
- package/dist/esm/audit/types.js +2 -0
- package/dist/esm/audit/types.js.map +1 -0
- package/dist/esm/audit/verify-cache.d.ts +127 -0
- package/dist/esm/audit/verify-cache.d.ts.map +1 -0
- package/dist/esm/audit/verify-cache.js +628 -0
- package/dist/esm/audit/verify-cache.js.map +1 -0
- package/dist/esm/channels/agent-session.d.ts +228 -0
- package/dist/esm/channels/agent-session.d.ts.map +1 -0
- package/dist/esm/channels/agent-session.js +566 -0
- package/dist/esm/channels/agent-session.js.map +1 -0
- package/dist/esm/channels/data-channel.d.ts +181 -0
- package/dist/esm/channels/data-channel.d.ts.map +1 -0
- package/dist/esm/channels/data-channel.js +567 -0
- package/dist/esm/channels/data-channel.js.map +1 -0
- package/dist/esm/channels/reconnect.d.ts +142 -0
- package/dist/esm/channels/reconnect.d.ts.map +1 -0
- package/dist/esm/channels/reconnect.js +234 -0
- package/dist/esm/channels/reconnect.js.map +1 -0
- package/dist/esm/channels/types.d.ts +112 -0
- package/dist/esm/channels/types.d.ts.map +1 -0
- package/dist/esm/channels/types.js +2 -0
- package/dist/esm/channels/types.js.map +1 -0
- package/dist/esm/channels/wake-channel.d.ts +232 -0
- package/dist/esm/channels/wake-channel.d.ts.map +1 -0
- package/dist/esm/channels/wake-channel.js +715 -0
- package/dist/esm/channels/wake-channel.js.map +1 -0
- package/dist/esm/cli/banner.d.ts +2 -0
- package/dist/esm/cli/banner.d.ts.map +1 -0
- package/dist/esm/cli/banner.js +114 -0
- package/dist/esm/cli/banner.js.map +1 -0
- package/dist/esm/cli/commands/agent.d.ts +30 -0
- package/dist/esm/cli/commands/agent.d.ts.map +1 -0
- package/dist/esm/cli/commands/agent.js +204 -0
- package/dist/esm/cli/commands/agent.js.map +1 -0
- package/dist/esm/cli/commands/audit-verify.d.ts +19 -0
- package/dist/esm/cli/commands/audit-verify.d.ts.map +1 -0
- package/dist/esm/cli/commands/audit-verify.js +345 -0
- package/dist/esm/cli/commands/audit-verify.js.map +1 -0
- package/dist/esm/cli/commands/clean.d.ts +23 -0
- package/dist/esm/cli/commands/clean.d.ts.map +1 -0
- package/dist/esm/cli/commands/clean.js +235 -0
- package/dist/esm/cli/commands/clean.js.map +1 -0
- package/dist/esm/cli/commands/config-show.d.ts +2 -0
- package/dist/esm/cli/commands/config-show.d.ts.map +1 -0
- package/dist/esm/cli/commands/config-show.js +2 -0
- package/dist/esm/cli/commands/config-show.js.map +1 -0
- package/dist/esm/cli/commands/config.d.ts +6 -0
- package/dist/esm/cli/commands/config.d.ts.map +1 -0
- package/dist/esm/cli/commands/config.js +259 -0
- package/dist/esm/cli/commands/config.js.map +1 -0
- package/dist/esm/cli/commands/db-add.d.ts +16 -0
- package/dist/esm/cli/commands/db-add.d.ts.map +1 -0
- package/dist/esm/cli/commands/db-add.js +576 -0
- package/dist/esm/cli/commands/db-add.js.map +1 -0
- package/dist/esm/cli/commands/db-edit.d.ts +2 -0
- package/dist/esm/cli/commands/db-edit.d.ts.map +1 -0
- package/dist/esm/cli/commands/db-edit.js +352 -0
- package/dist/esm/cli/commands/db-edit.js.map +1 -0
- package/dist/esm/cli/commands/db-logs.d.ts +3 -0
- package/dist/esm/cli/commands/db-logs.d.ts.map +1 -0
- package/dist/esm/cli/commands/db-logs.js +64 -0
- package/dist/esm/cli/commands/db-logs.js.map +1 -0
- package/dist/esm/cli/commands/db-ls.d.ts +2 -0
- package/dist/esm/cli/commands/db-ls.d.ts.map +1 -0
- package/dist/esm/cli/commands/db-ls.js +115 -0
- package/dist/esm/cli/commands/db-ls.js.map +1 -0
- package/dist/esm/cli/commands/db-query.d.ts +121 -0
- package/dist/esm/cli/commands/db-query.d.ts.map +1 -0
- package/dist/esm/cli/commands/db-query.js +754 -0
- package/dist/esm/cli/commands/db-query.js.map +1 -0
- package/dist/esm/cli/commands/db-remove.d.ts +2 -0
- package/dist/esm/cli/commands/db-remove.d.ts.map +1 -0
- package/dist/esm/cli/commands/db-remove.js +48 -0
- package/dist/esm/cli/commands/db-remove.js.map +1 -0
- package/dist/esm/cli/commands/db-show.d.ts +2 -0
- package/dist/esm/cli/commands/db-show.d.ts.map +1 -0
- package/dist/esm/cli/commands/db-show.js +131 -0
- package/dist/esm/cli/commands/db-show.js.map +1 -0
- package/dist/esm/cli/commands/db-test.d.ts +3 -0
- package/dist/esm/cli/commands/db-test.d.ts.map +1 -0
- package/dist/esm/cli/commands/db-test.js +307 -0
- package/dist/esm/cli/commands/db-test.js.map +1 -0
- package/dist/esm/cli/commands/db.d.ts +11 -0
- package/dist/esm/cli/commands/db.d.ts.map +1 -0
- package/dist/esm/cli/commands/db.js +76 -0
- package/dist/esm/cli/commands/db.js.map +1 -0
- package/dist/esm/cli/commands/debug.d.ts +2 -0
- package/dist/esm/cli/commands/debug.d.ts.map +1 -0
- package/dist/esm/cli/commands/debug.js +205 -0
- package/dist/esm/cli/commands/debug.js.map +1 -0
- package/dist/esm/cli/commands/doctor.d.ts +5 -0
- package/dist/esm/cli/commands/doctor.d.ts.map +1 -0
- package/dist/esm/cli/commands/doctor.js +114 -0
- package/dist/esm/cli/commands/doctor.js.map +1 -0
- package/dist/esm/cli/commands/index.d.ts +10 -0
- package/dist/esm/cli/commands/index.d.ts.map +1 -0
- package/dist/esm/cli/commands/index.js +10 -0
- package/dist/esm/cli/commands/index.js.map +1 -0
- package/dist/esm/cli/commands/init.d.ts +2 -0
- package/dist/esm/cli/commands/init.d.ts.map +1 -0
- package/dist/esm/cli/commands/init.js +163 -0
- package/dist/esm/cli/commands/init.js.map +1 -0
- package/dist/esm/cli/commands/link.d.ts +5 -0
- package/dist/esm/cli/commands/link.d.ts.map +1 -0
- package/dist/esm/cli/commands/link.js +41 -0
- package/dist/esm/cli/commands/link.js.map +1 -0
- package/dist/esm/cli/commands/logs.d.ts +17 -0
- package/dist/esm/cli/commands/logs.d.ts.map +1 -0
- package/dist/esm/cli/commands/logs.js +278 -0
- package/dist/esm/cli/commands/logs.js.map +1 -0
- package/dist/esm/cli/commands/project-show.d.ts +2 -0
- package/dist/esm/cli/commands/project-show.d.ts.map +1 -0
- package/dist/esm/cli/commands/project-show.js +69 -0
- package/dist/esm/cli/commands/project-show.js.map +1 -0
- package/dist/esm/cli/commands/project.d.ts +3 -0
- package/dist/esm/cli/commands/project.d.ts.map +1 -0
- package/dist/esm/cli/commands/project.js +60 -0
- package/dist/esm/cli/commands/project.js.map +1 -0
- package/dist/esm/cli/commands/service.d.ts +123 -0
- package/dist/esm/cli/commands/service.d.ts.map +1 -0
- package/dist/esm/cli/commands/service.js +505 -0
- package/dist/esm/cli/commands/service.js.map +1 -0
- package/dist/esm/cli/commands/start.d.ts +6 -0
- package/dist/esm/cli/commands/start.d.ts.map +1 -0
- package/dist/esm/cli/commands/start.js +272 -0
- package/dist/esm/cli/commands/start.js.map +1 -0
- package/dist/esm/cli/commands/status.d.ts +2 -0
- package/dist/esm/cli/commands/status.d.ts.map +1 -0
- package/dist/esm/cli/commands/status.js +222 -0
- package/dist/esm/cli/commands/status.js.map +1 -0
- package/dist/esm/cli/commands/stop.d.ts +6 -0
- package/dist/esm/cli/commands/stop.d.ts.map +1 -0
- package/dist/esm/cli/commands/stop.js +96 -0
- package/dist/esm/cli/commands/stop.js.map +1 -0
- package/dist/esm/cli/daemon/error-tracker.d.ts +119 -0
- package/dist/esm/cli/daemon/error-tracker.d.ts.map +1 -0
- package/dist/esm/cli/daemon/error-tracker.js +451 -0
- package/dist/esm/cli/daemon/error-tracker.js.map +1 -0
- package/dist/esm/cli/daemon/fault-shutdown.d.ts +144 -0
- package/dist/esm/cli/daemon/fault-shutdown.d.ts.map +1 -0
- package/dist/esm/cli/daemon/fault-shutdown.js +273 -0
- package/dist/esm/cli/daemon/fault-shutdown.js.map +1 -0
- package/dist/esm/cli/daemon/index.d.ts +12 -0
- package/dist/esm/cli/daemon/index.d.ts.map +1 -0
- package/dist/esm/cli/daemon/index.js +7 -0
- package/dist/esm/cli/daemon/index.js.map +1 -0
- package/dist/esm/cli/daemon/pid-file.d.ts +13 -0
- package/dist/esm/cli/daemon/pid-file.d.ts.map +1 -0
- package/dist/esm/cli/daemon/pid-file.js +51 -0
- package/dist/esm/cli/daemon/pid-file.js.map +1 -0
- package/dist/esm/cli/daemon/readiness.d.ts +30 -0
- package/dist/esm/cli/daemon/readiness.d.ts.map +1 -0
- package/dist/esm/cli/daemon/readiness.js +70 -0
- package/dist/esm/cli/daemon/readiness.js.map +1 -0
- package/dist/esm/cli/daemon/runtime.d.ts +366 -0
- package/dist/esm/cli/daemon/runtime.d.ts.map +1 -0
- package/dist/esm/cli/daemon/runtime.js +1284 -0
- package/dist/esm/cli/daemon/runtime.js.map +1 -0
- package/dist/esm/cli/daemon/shutdown.d.ts +7 -0
- package/dist/esm/cli/daemon/shutdown.d.ts.map +1 -0
- package/dist/esm/cli/daemon/shutdown.js +63 -0
- package/dist/esm/cli/daemon/shutdown.js.map +1 -0
- package/dist/esm/cli/daemon/signal-handlers.d.ts +3 -0
- package/dist/esm/cli/daemon/signal-handlers.d.ts.map +1 -0
- package/dist/esm/cli/daemon/signal-handlers.js +24 -0
- package/dist/esm/cli/daemon/signal-handlers.js.map +1 -0
- package/dist/esm/cli/daemon/state.d.ts +157 -0
- package/dist/esm/cli/daemon/state.d.ts.map +1 -0
- package/dist/esm/cli/daemon/state.js +352 -0
- package/dist/esm/cli/daemon/state.js.map +1 -0
- package/dist/esm/cli/daemon/status-file.d.ts +139 -0
- package/dist/esm/cli/daemon/status-file.d.ts.map +1 -0
- package/dist/esm/cli/daemon/status-file.js +50 -0
- package/dist/esm/cli/daemon/status-file.js.map +1 -0
- package/dist/esm/cli/doctor/checks.d.ts +133 -0
- package/dist/esm/cli/doctor/checks.d.ts.map +1 -0
- package/dist/esm/cli/doctor/checks.js +624 -0
- package/dist/esm/cli/doctor/checks.js.map +1 -0
- package/dist/esm/cli/doctor/fixes.d.ts +9 -0
- package/dist/esm/cli/doctor/fixes.d.ts.map +1 -0
- package/dist/esm/cli/doctor/fixes.js +163 -0
- package/dist/esm/cli/doctor/fixes.js.map +1 -0
- package/dist/esm/cli/doctor/index.d.ts +7 -0
- package/dist/esm/cli/doctor/index.d.ts.map +1 -0
- package/dist/esm/cli/doctor/index.js +5 -0
- package/dist/esm/cli/doctor/index.js.map +1 -0
- package/dist/esm/cli/index.d.ts +3 -0
- package/dist/esm/cli/index.d.ts.map +1 -0
- package/dist/esm/cli/index.js +333 -0
- package/dist/esm/cli/index.js.map +1 -0
- package/dist/esm/cli/interactive.d.ts +8 -0
- package/dist/esm/cli/interactive.d.ts.map +1 -0
- package/dist/esm/cli/interactive.js +665 -0
- package/dist/esm/cli/interactive.js.map +1 -0
- package/dist/esm/cli/logs/format.d.ts +13 -0
- package/dist/esm/cli/logs/format.d.ts.map +1 -0
- package/dist/esm/cli/logs/format.js +169 -0
- package/dist/esm/cli/logs/format.js.map +1 -0
- package/dist/esm/cli/logs/index.d.ts +3 -0
- package/dist/esm/cli/logs/index.d.ts.map +1 -0
- package/dist/esm/cli/logs/index.js +3 -0
- package/dist/esm/cli/logs/index.js.map +1 -0
- package/dist/esm/cli/logs/viewer.d.ts +41 -0
- package/dist/esm/cli/logs/viewer.d.ts.map +1 -0
- package/dist/esm/cli/logs/viewer.js +412 -0
- package/dist/esm/cli/logs/viewer.js.map +1 -0
- package/dist/esm/cli/ops/operation-logger.d.ts +63 -0
- package/dist/esm/cli/ops/operation-logger.d.ts.map +1 -0
- package/dist/esm/cli/ops/operation-logger.js +142 -0
- package/dist/esm/cli/ops/operation-logger.js.map +1 -0
- package/dist/esm/cli/palette.d.ts +11 -0
- package/dist/esm/cli/palette.d.ts.map +1 -0
- package/dist/esm/cli/palette.js +240 -0
- package/dist/esm/cli/palette.js.map +1 -0
- package/dist/esm/cli/prompt.d.ts +186 -0
- package/dist/esm/cli/prompt.d.ts.map +1 -0
- package/dist/esm/cli/prompt.js +483 -0
- package/dist/esm/cli/prompt.js.map +1 -0
- package/dist/esm/cli/ui/box.d.ts +21 -0
- package/dist/esm/cli/ui/box.d.ts.map +1 -0
- package/dist/esm/cli/ui/box.js +60 -0
- package/dist/esm/cli/ui/box.js.map +1 -0
- package/dist/esm/cli/ui/clipboard.d.ts +6 -0
- package/dist/esm/cli/ui/clipboard.d.ts.map +1 -0
- package/dist/esm/cli/ui/clipboard.js +42 -0
- package/dist/esm/cli/ui/clipboard.js.map +1 -0
- package/dist/esm/cli/ui/colors.d.ts +57 -0
- package/dist/esm/cli/ui/colors.d.ts.map +1 -0
- package/dist/esm/cli/ui/colors.js +126 -0
- package/dist/esm/cli/ui/colors.js.map +1 -0
- package/dist/esm/cli/ui/index.d.ts +9 -0
- package/dist/esm/cli/ui/index.d.ts.map +1 -0
- package/dist/esm/cli/ui/index.js +7 -0
- package/dist/esm/cli/ui/index.js.map +1 -0
- package/dist/esm/cli/ui/spinner.d.ts +12 -0
- package/dist/esm/cli/ui/spinner.d.ts.map +1 -0
- package/dist/esm/cli/ui/spinner.js +78 -0
- package/dist/esm/cli/ui/spinner.js.map +1 -0
- package/dist/esm/cli/ui/symbols.d.ts +47 -0
- package/dist/esm/cli/ui/symbols.d.ts.map +1 -0
- package/dist/esm/cli/ui/symbols.js +109 -0
- package/dist/esm/cli/ui/symbols.js.map +1 -0
- package/dist/esm/cli/ui/table.d.ts +23 -0
- package/dist/esm/cli/ui/table.d.ts.map +1 -0
- package/dist/esm/cli/ui/table.js +156 -0
- package/dist/esm/cli/ui/table.js.map +1 -0
- package/dist/esm/cli/ui/terminal.d.ts +7 -0
- package/dist/esm/cli/ui/terminal.d.ts.map +1 -0
- package/dist/esm/cli/ui/terminal.js +32 -0
- package/dist/esm/cli/ui/terminal.js.map +1 -0
- package/dist/esm/config/atomic-write.d.ts +69 -0
- package/dist/esm/config/atomic-write.d.ts.map +1 -0
- package/dist/esm/config/atomic-write.js +246 -0
- package/dist/esm/config/atomic-write.js.map +1 -0
- package/dist/esm/config/db-config.d.ts +134 -0
- package/dist/esm/config/db-config.d.ts.map +1 -0
- package/dist/esm/config/db-config.js +542 -0
- package/dist/esm/config/db-config.js.map +1 -0
- package/dist/esm/config/machine-config.d.ts +85 -0
- package/dist/esm/config/machine-config.d.ts.map +1 -0
- package/dist/esm/config/machine-config.js +190 -0
- package/dist/esm/config/machine-config.js.map +1 -0
- package/dist/esm/config/paths.d.ts +64 -0
- package/dist/esm/config/paths.d.ts.map +1 -0
- package/dist/esm/config/paths.js +108 -0
- package/dist/esm/config/paths.js.map +1 -0
- package/dist/esm/config/schema.d.ts +72 -0
- package/dist/esm/config/schema.d.ts.map +1 -0
- package/dist/esm/config/schema.js +180 -0
- package/dist/esm/config/schema.js.map +1 -0
- package/dist/esm/config/token.d.ts +63 -0
- package/dist/esm/config/token.d.ts.map +1 -0
- package/dist/esm/config/token.js +104 -0
- package/dist/esm/config/token.js.map +1 -0
- package/dist/esm/execution/canceller.d.ts +41 -0
- package/dist/esm/execution/canceller.d.ts.map +1 -0
- package/dist/esm/execution/canceller.js +205 -0
- package/dist/esm/execution/canceller.js.map +1 -0
- package/dist/esm/execution/database-lookup.d.ts +56 -0
- package/dist/esm/execution/database-lookup.d.ts.map +1 -0
- package/dist/esm/execution/database-lookup.js +38 -0
- package/dist/esm/execution/database-lookup.js.map +1 -0
- package/dist/esm/execution/dispatcher.d.ts +181 -0
- package/dist/esm/execution/dispatcher.d.ts.map +1 -0
- package/dist/esm/execution/dispatcher.js +1258 -0
- package/dist/esm/execution/dispatcher.js.map +1 -0
- package/dist/esm/execution/function-effects.d.ts +209 -0
- package/dist/esm/execution/function-effects.d.ts.map +1 -0
- package/dist/esm/execution/function-effects.js +586 -0
- package/dist/esm/execution/function-effects.js.map +1 -0
- package/dist/esm/execution/introspection.d.ts +76 -0
- package/dist/esm/execution/introspection.d.ts.map +1 -0
- package/dist/esm/execution/introspection.js +442 -0
- package/dist/esm/execution/introspection.js.map +1 -0
- package/dist/esm/execution/migration-runner.d.ts +128 -0
- package/dist/esm/execution/migration-runner.d.ts.map +1 -0
- package/dist/esm/execution/migration-runner.js +754 -0
- package/dist/esm/execution/migration-runner.js.map +1 -0
- package/dist/esm/execution/non-tx-detector.d.ts +23 -0
- package/dist/esm/execution/non-tx-detector.d.ts.map +1 -0
- package/dist/esm/execution/non-tx-detector.js +215 -0
- package/dist/esm/execution/non-tx-detector.js.map +1 -0
- package/dist/esm/execution/pool.d.ts +229 -0
- package/dist/esm/execution/pool.d.ts.map +1 -0
- package/dist/esm/execution/pool.js +685 -0
- package/dist/esm/execution/pool.js.map +1 -0
- package/dist/esm/execution/query-runner.d.ts +88 -0
- package/dist/esm/execution/query-runner.d.ts.map +1 -0
- package/dist/esm/execution/query-runner.js +743 -0
- package/dist/esm/execution/query-runner.js.map +1 -0
- package/dist/esm/execution/rate-limiter.d.ts +120 -0
- package/dist/esm/execution/rate-limiter.d.ts.map +1 -0
- package/dist/esm/execution/rate-limiter.js +269 -0
- package/dist/esm/execution/rate-limiter.js.map +1 -0
- package/dist/esm/execution/search-path.d.ts +161 -0
- package/dist/esm/execution/search-path.d.ts.map +1 -0
- package/dist/esm/execution/search-path.js +270 -0
- package/dist/esm/execution/search-path.js.map +1 -0
- package/dist/esm/execution/sql-parser.d.ts +195 -0
- package/dist/esm/execution/sql-parser.d.ts.map +1 -0
- package/dist/esm/execution/sql-parser.js +683 -0
- package/dist/esm/execution/sql-parser.js.map +1 -0
- package/dist/esm/execution/statement-classifier.d.ts +103 -0
- package/dist/esm/execution/statement-classifier.d.ts.map +1 -0
- package/dist/esm/execution/statement-classifier.js +526 -0
- package/dist/esm/execution/statement-classifier.js.map +1 -0
- package/dist/esm/execution/types.d.ts +189 -0
- package/dist/esm/execution/types.d.ts.map +1 -0
- package/dist/esm/execution/types.js +22 -0
- package/dist/esm/execution/types.js.map +1 -0
- package/dist/esm/index.d.ts +34 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +38 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/permissions/auto-upgrade.d.ts +40 -0
- package/dist/esm/permissions/auto-upgrade.d.ts.map +1 -0
- package/dist/esm/permissions/auto-upgrade.js +164 -0
- package/dist/esm/permissions/auto-upgrade.js.map +1 -0
- package/dist/esm/permissions/checker.d.ts +53 -0
- package/dist/esm/permissions/checker.d.ts.map +1 -0
- package/dist/esm/permissions/checker.js +322 -0
- package/dist/esm/permissions/checker.js.map +1 -0
- package/dist/esm/permissions/manual-approval.d.ts +213 -0
- package/dist/esm/permissions/manual-approval.d.ts.map +1 -0
- package/dist/esm/permissions/manual-approval.js +503 -0
- package/dist/esm/permissions/manual-approval.js.map +1 -0
- package/dist/esm/permissions/plan-registry.d.ts +274 -0
- package/dist/esm/permissions/plan-registry.d.ts.map +1 -0
- package/dist/esm/permissions/plan-registry.js +450 -0
- package/dist/esm/permissions/plan-registry.js.map +1 -0
- package/dist/esm/permissions/role-policy.d.ts +217 -0
- package/dist/esm/permissions/role-policy.d.ts.map +1 -0
- package/dist/esm/permissions/role-policy.js +570 -0
- package/dist/esm/permissions/role-policy.js.map +1 -0
- package/dist/esm/permissions/types.d.ts +126 -0
- package/dist/esm/permissions/types.d.ts.map +1 -0
- package/dist/esm/permissions/types.js +2 -0
- package/dist/esm/permissions/types.js.map +1 -0
- package/dist/esm/protocol/constants.d.ts +72 -0
- package/dist/esm/protocol/constants.d.ts.map +1 -0
- package/dist/esm/protocol/constants.js +104 -0
- package/dist/esm/protocol/constants.js.map +1 -0
- package/dist/esm/protocol/envelope.d.ts +165 -0
- package/dist/esm/protocol/envelope.d.ts.map +1 -0
- package/dist/esm/protocol/envelope.js +263 -0
- package/dist/esm/protocol/envelope.js.map +1 -0
- package/dist/esm/protocol/errors.d.ts +33 -0
- package/dist/esm/protocol/errors.d.ts.map +1 -0
- package/dist/esm/protocol/errors.js +384 -0
- package/dist/esm/protocol/errors.js.map +1 -0
- package/dist/esm/protocol/messages.d.ts +327 -0
- package/dist/esm/protocol/messages.d.ts.map +1 -0
- package/dist/esm/protocol/messages.js +2 -0
- package/dist/esm/protocol/messages.js.map +1 -0
- package/dist/esm/protocol/serialize.d.ts +26 -0
- package/dist/esm/protocol/serialize.d.ts.map +1 -0
- package/dist/esm/protocol/serialize.js +63 -0
- package/dist/esm/protocol/serialize.js.map +1 -0
- package/dist/esm/protocol/validate.d.ts +135 -0
- package/dist/esm/protocol/validate.d.ts.map +1 -0
- package/dist/esm/protocol/validate.js +830 -0
- package/dist/esm/protocol/validate.js.map +1 -0
- package/dist/types/audit/chain.d.ts +365 -0
- package/dist/types/audit/chain.d.ts.map +1 -0
- package/dist/types/audit/cloud-client.d.ts +142 -0
- package/dist/types/audit/cloud-client.d.ts.map +1 -0
- package/dist/types/audit/cloud-writer.d.ts +57 -0
- package/dist/types/audit/cloud-writer.d.ts.map +1 -0
- package/dist/types/audit/context.d.ts +51 -0
- package/dist/types/audit/context.d.ts.map +1 -0
- package/dist/types/audit/files.d.ts +111 -0
- package/dist/types/audit/files.d.ts.map +1 -0
- package/dist/types/audit/index.d.ts +9 -0
- package/dist/types/audit/index.d.ts.map +1 -0
- package/dist/types/audit/local-writer.d.ts +255 -0
- package/dist/types/audit/local-writer.d.ts.map +1 -0
- package/dist/types/audit/redact.d.ts +151 -0
- package/dist/types/audit/redact.d.ts.map +1 -0
- package/dist/types/audit/sanitize.d.ts +78 -0
- package/dist/types/audit/sanitize.d.ts.map +1 -0
- package/dist/types/audit/sink.d.ts +278 -0
- package/dist/types/audit/sink.d.ts.map +1 -0
- package/dist/types/audit/types.d.ts +226 -0
- package/dist/types/audit/types.d.ts.map +1 -0
- package/dist/types/audit/verify-cache.d.ts +127 -0
- package/dist/types/audit/verify-cache.d.ts.map +1 -0
- package/dist/types/channels/agent-session.d.ts +228 -0
- package/dist/types/channels/agent-session.d.ts.map +1 -0
- package/dist/types/channels/data-channel.d.ts +181 -0
- package/dist/types/channels/data-channel.d.ts.map +1 -0
- package/dist/types/channels/reconnect.d.ts +142 -0
- package/dist/types/channels/reconnect.d.ts.map +1 -0
- package/dist/types/channels/types.d.ts +112 -0
- package/dist/types/channels/types.d.ts.map +1 -0
- package/dist/types/channels/wake-channel.d.ts +232 -0
- package/dist/types/channels/wake-channel.d.ts.map +1 -0
- package/dist/types/cli/banner.d.ts +2 -0
- package/dist/types/cli/banner.d.ts.map +1 -0
- package/dist/types/cli/commands/agent.d.ts +30 -0
- package/dist/types/cli/commands/agent.d.ts.map +1 -0
- package/dist/types/cli/commands/audit-verify.d.ts +19 -0
- package/dist/types/cli/commands/audit-verify.d.ts.map +1 -0
- package/dist/types/cli/commands/clean.d.ts +23 -0
- package/dist/types/cli/commands/clean.d.ts.map +1 -0
- package/dist/types/cli/commands/config-show.d.ts +2 -0
- package/dist/types/cli/commands/config-show.d.ts.map +1 -0
- package/dist/types/cli/commands/config.d.ts +6 -0
- package/dist/types/cli/commands/config.d.ts.map +1 -0
- package/dist/types/cli/commands/db-add.d.ts +16 -0
- package/dist/types/cli/commands/db-add.d.ts.map +1 -0
- package/dist/types/cli/commands/db-edit.d.ts +2 -0
- package/dist/types/cli/commands/db-edit.d.ts.map +1 -0
- package/dist/types/cli/commands/db-logs.d.ts +3 -0
- package/dist/types/cli/commands/db-logs.d.ts.map +1 -0
- package/dist/types/cli/commands/db-ls.d.ts +2 -0
- package/dist/types/cli/commands/db-ls.d.ts.map +1 -0
- package/dist/types/cli/commands/db-query.d.ts +121 -0
- package/dist/types/cli/commands/db-query.d.ts.map +1 -0
- package/dist/types/cli/commands/db-remove.d.ts +2 -0
- package/dist/types/cli/commands/db-remove.d.ts.map +1 -0
- package/dist/types/cli/commands/db-show.d.ts +2 -0
- package/dist/types/cli/commands/db-show.d.ts.map +1 -0
- package/dist/types/cli/commands/db-test.d.ts +3 -0
- package/dist/types/cli/commands/db-test.d.ts.map +1 -0
- package/dist/types/cli/commands/db.d.ts +11 -0
- package/dist/types/cli/commands/db.d.ts.map +1 -0
- package/dist/types/cli/commands/debug.d.ts +2 -0
- package/dist/types/cli/commands/debug.d.ts.map +1 -0
- package/dist/types/cli/commands/doctor.d.ts +5 -0
- package/dist/types/cli/commands/doctor.d.ts.map +1 -0
- package/dist/types/cli/commands/index.d.ts +10 -0
- package/dist/types/cli/commands/index.d.ts.map +1 -0
- package/dist/types/cli/commands/init.d.ts +2 -0
- package/dist/types/cli/commands/init.d.ts.map +1 -0
- package/dist/types/cli/commands/link.d.ts +5 -0
- package/dist/types/cli/commands/link.d.ts.map +1 -0
- package/dist/types/cli/commands/logs.d.ts +17 -0
- package/dist/types/cli/commands/logs.d.ts.map +1 -0
- package/dist/types/cli/commands/project-show.d.ts +2 -0
- package/dist/types/cli/commands/project-show.d.ts.map +1 -0
- package/dist/types/cli/commands/project.d.ts +3 -0
- package/dist/types/cli/commands/project.d.ts.map +1 -0
- package/dist/types/cli/commands/service.d.ts +123 -0
- package/dist/types/cli/commands/service.d.ts.map +1 -0
- package/dist/types/cli/commands/start.d.ts +6 -0
- package/dist/types/cli/commands/start.d.ts.map +1 -0
- package/dist/types/cli/commands/status.d.ts +2 -0
- package/dist/types/cli/commands/status.d.ts.map +1 -0
- package/dist/types/cli/commands/stop.d.ts +6 -0
- package/dist/types/cli/commands/stop.d.ts.map +1 -0
- package/dist/types/cli/daemon/error-tracker.d.ts +119 -0
- package/dist/types/cli/daemon/error-tracker.d.ts.map +1 -0
- package/dist/types/cli/daemon/fault-shutdown.d.ts +144 -0
- package/dist/types/cli/daemon/fault-shutdown.d.ts.map +1 -0
- package/dist/types/cli/daemon/index.d.ts +12 -0
- package/dist/types/cli/daemon/index.d.ts.map +1 -0
- package/dist/types/cli/daemon/pid-file.d.ts +13 -0
- package/dist/types/cli/daemon/pid-file.d.ts.map +1 -0
- package/dist/types/cli/daemon/readiness.d.ts +30 -0
- package/dist/types/cli/daemon/readiness.d.ts.map +1 -0
- package/dist/types/cli/daemon/runtime.d.ts +366 -0
- package/dist/types/cli/daemon/runtime.d.ts.map +1 -0
- package/dist/types/cli/daemon/shutdown.d.ts +7 -0
- package/dist/types/cli/daemon/shutdown.d.ts.map +1 -0
- package/dist/types/cli/daemon/signal-handlers.d.ts +3 -0
- package/dist/types/cli/daemon/signal-handlers.d.ts.map +1 -0
- package/dist/types/cli/daemon/state.d.ts +157 -0
- package/dist/types/cli/daemon/state.d.ts.map +1 -0
- package/dist/types/cli/daemon/status-file.d.ts +139 -0
- package/dist/types/cli/daemon/status-file.d.ts.map +1 -0
- package/dist/types/cli/doctor/checks.d.ts +133 -0
- package/dist/types/cli/doctor/checks.d.ts.map +1 -0
- package/dist/types/cli/doctor/fixes.d.ts +9 -0
- package/dist/types/cli/doctor/fixes.d.ts.map +1 -0
- package/dist/types/cli/doctor/index.d.ts +7 -0
- package/dist/types/cli/doctor/index.d.ts.map +1 -0
- package/dist/types/cli/index.d.ts +3 -0
- package/dist/types/cli/index.d.ts.map +1 -0
- package/dist/types/cli/interactive.d.ts +8 -0
- package/dist/types/cli/interactive.d.ts.map +1 -0
- package/dist/types/cli/logs/format.d.ts +13 -0
- package/dist/types/cli/logs/format.d.ts.map +1 -0
- package/dist/types/cli/logs/index.d.ts +3 -0
- package/dist/types/cli/logs/index.d.ts.map +1 -0
- package/dist/types/cli/logs/viewer.d.ts +41 -0
- package/dist/types/cli/logs/viewer.d.ts.map +1 -0
- package/dist/types/cli/ops/operation-logger.d.ts +63 -0
- package/dist/types/cli/ops/operation-logger.d.ts.map +1 -0
- package/dist/types/cli/palette.d.ts +11 -0
- package/dist/types/cli/palette.d.ts.map +1 -0
- package/dist/types/cli/prompt.d.ts +186 -0
- package/dist/types/cli/prompt.d.ts.map +1 -0
- package/dist/types/cli/ui/box.d.ts +21 -0
- package/dist/types/cli/ui/box.d.ts.map +1 -0
- package/dist/types/cli/ui/clipboard.d.ts +6 -0
- package/dist/types/cli/ui/clipboard.d.ts.map +1 -0
- package/dist/types/cli/ui/colors.d.ts +57 -0
- package/dist/types/cli/ui/colors.d.ts.map +1 -0
- package/dist/types/cli/ui/index.d.ts +9 -0
- package/dist/types/cli/ui/index.d.ts.map +1 -0
- package/dist/types/cli/ui/spinner.d.ts +12 -0
- package/dist/types/cli/ui/spinner.d.ts.map +1 -0
- package/dist/types/cli/ui/symbols.d.ts +47 -0
- package/dist/types/cli/ui/symbols.d.ts.map +1 -0
- package/dist/types/cli/ui/table.d.ts +23 -0
- package/dist/types/cli/ui/table.d.ts.map +1 -0
- package/dist/types/cli/ui/terminal.d.ts +7 -0
- package/dist/types/cli/ui/terminal.d.ts.map +1 -0
- package/dist/types/config/atomic-write.d.ts +69 -0
- package/dist/types/config/atomic-write.d.ts.map +1 -0
- package/dist/types/config/db-config.d.ts +134 -0
- package/dist/types/config/db-config.d.ts.map +1 -0
- package/dist/types/config/machine-config.d.ts +85 -0
- package/dist/types/config/machine-config.d.ts.map +1 -0
- package/dist/types/config/paths.d.ts +64 -0
- package/dist/types/config/paths.d.ts.map +1 -0
- package/dist/types/config/schema.d.ts +72 -0
- package/dist/types/config/schema.d.ts.map +1 -0
- package/dist/types/config/token.d.ts +63 -0
- package/dist/types/config/token.d.ts.map +1 -0
- package/dist/types/execution/canceller.d.ts +41 -0
- package/dist/types/execution/canceller.d.ts.map +1 -0
- package/dist/types/execution/database-lookup.d.ts +56 -0
- package/dist/types/execution/database-lookup.d.ts.map +1 -0
- package/dist/types/execution/dispatcher.d.ts +181 -0
- package/dist/types/execution/dispatcher.d.ts.map +1 -0
- package/dist/types/execution/function-effects.d.ts +209 -0
- package/dist/types/execution/function-effects.d.ts.map +1 -0
- package/dist/types/execution/introspection.d.ts +76 -0
- package/dist/types/execution/introspection.d.ts.map +1 -0
- package/dist/types/execution/migration-runner.d.ts +128 -0
- package/dist/types/execution/migration-runner.d.ts.map +1 -0
- package/dist/types/execution/non-tx-detector.d.ts +23 -0
- package/dist/types/execution/non-tx-detector.d.ts.map +1 -0
- package/dist/types/execution/pool.d.ts +229 -0
- package/dist/types/execution/pool.d.ts.map +1 -0
- package/dist/types/execution/query-runner.d.ts +88 -0
- package/dist/types/execution/query-runner.d.ts.map +1 -0
- package/dist/types/execution/rate-limiter.d.ts +120 -0
- package/dist/types/execution/rate-limiter.d.ts.map +1 -0
- package/dist/types/execution/search-path.d.ts +161 -0
- package/dist/types/execution/search-path.d.ts.map +1 -0
- package/dist/types/execution/sql-parser.d.ts +195 -0
- package/dist/types/execution/sql-parser.d.ts.map +1 -0
- package/dist/types/execution/statement-classifier.d.ts +103 -0
- package/dist/types/execution/statement-classifier.d.ts.map +1 -0
- package/dist/types/execution/types.d.ts +189 -0
- package/dist/types/execution/types.d.ts.map +1 -0
- package/dist/types/index.d.ts +34 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/permissions/auto-upgrade.d.ts +40 -0
- package/dist/types/permissions/auto-upgrade.d.ts.map +1 -0
- package/dist/types/permissions/checker.d.ts +53 -0
- package/dist/types/permissions/checker.d.ts.map +1 -0
- package/dist/types/permissions/manual-approval.d.ts +213 -0
- package/dist/types/permissions/manual-approval.d.ts.map +1 -0
- package/dist/types/permissions/plan-registry.d.ts +274 -0
- package/dist/types/permissions/plan-registry.d.ts.map +1 -0
- package/dist/types/permissions/role-policy.d.ts +217 -0
- package/dist/types/permissions/role-policy.d.ts.map +1 -0
- package/dist/types/permissions/types.d.ts +126 -0
- package/dist/types/permissions/types.d.ts.map +1 -0
- package/dist/types/protocol/constants.d.ts +72 -0
- package/dist/types/protocol/constants.d.ts.map +1 -0
- package/dist/types/protocol/envelope.d.ts +165 -0
- package/dist/types/protocol/envelope.d.ts.map +1 -0
- package/dist/types/protocol/errors.d.ts +33 -0
- package/dist/types/protocol/errors.d.ts.map +1 -0
- package/dist/types/protocol/messages.d.ts +327 -0
- package/dist/types/protocol/messages.d.ts.map +1 -0
- package/dist/types/protocol/serialize.d.ts +26 -0
- package/dist/types/protocol/serialize.d.ts.map +1 -0
- package/dist/types/protocol/validate.d.ts +135 -0
- package/dist/types/protocol/validate.d.ts.map +1 -0
- package/package.json +116 -4
- package/scripts/generate-systemd-service.mjs +117 -0
|
@@ -0,0 +1,819 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.AuditSink = void 0;
|
|
37
|
+
const crypto = __importStar(require("crypto"));
|
|
38
|
+
const chain_1 = require("./chain");
|
|
39
|
+
const context_1 = require("./context");
|
|
40
|
+
const DEFAULT_BUFFER_SIZE = 1024;
|
|
41
|
+
const DEFAULT_MAX_SCAN_RECORDS = 200_000;
|
|
42
|
+
/** Hard cap on queued records. See {@link AuditSinkOptions.maxQueueItems}. */
|
|
43
|
+
const DEFAULT_MAX_QUEUE_ITEMS = 4_096;
|
|
44
|
+
/** Report the queue high-water mark after this many overflow admissions. */
|
|
45
|
+
const OVERFLOW_REPORT_THRESHOLD = 64;
|
|
46
|
+
/** Re-announce a growing drop total at these multiples. */
|
|
47
|
+
const DROP_REPORT_INTERVAL = 64;
|
|
48
|
+
/**
|
|
49
|
+
* The audit sink: builds keyed, sequenced records, appends them locally and
|
|
50
|
+
* mirrors them to the cloud.
|
|
51
|
+
*
|
|
52
|
+
* Chain integrity rules:
|
|
53
|
+
* - every record is MAC'd with the installation key and stamped with a
|
|
54
|
+
* monotonically increasing `seq`
|
|
55
|
+
* - `{seq, last_hash}` is anchored in `head.json` at every durable commit
|
|
56
|
+
* - the head is recovered on first append (from `head.json` plus the tail of
|
|
57
|
+
* the newest log file), so a restart continues the chain instead of
|
|
58
|
+
* restarting it (finding H-13)
|
|
59
|
+
* - a tail that does not verify is a loud, exposed failure — never a silent
|
|
60
|
+
* new chain in the same file
|
|
61
|
+
*
|
|
62
|
+
* Buffer pressure (findings M-04, M-07): every write is serialised through one
|
|
63
|
+
* FIFO write lane, which is what keeps `seq`/`prev_hash` coherent. Records split
|
|
64
|
+
* by how they reach that lane:
|
|
65
|
+
* - **never queued** — `logSync()` (an awaited record) and any record carrying
|
|
66
|
+
* an authorization decision (`allow`/`deny`). They take the write lane
|
|
67
|
+
* directly, so no amount of pressure can drop one, reject one, or make its
|
|
68
|
+
* caller wait for queue space. This is the guaranteed path.
|
|
69
|
+
* - **queued** — fire-and-forget `log()` records with no authorization
|
|
70
|
+
* decision (manual-approval lifecycle telemetry). The queue is hard-capped
|
|
71
|
+
* at `maxQueueItems`; past it the **oldest** are dropped and counted, so
|
|
72
|
+
* sustained pressure cannot grow the heap without bound.
|
|
73
|
+
*
|
|
74
|
+
* A full queue is therefore not an error and never rejects a caller; the loss is
|
|
75
|
+
* counted (`getHealth().dropped`), logged, persisted as an `audit_overflow`
|
|
76
|
+
* record and handed to `onDrop`.
|
|
77
|
+
*
|
|
78
|
+
* Every record also carries the **resolved** database identity
|
|
79
|
+
* (`resolved_db_alias`, `resolved_database`), taken from the per-request context
|
|
80
|
+
* established by `withResolvedDatabase` and never from the caller. With
|
|
81
|
+
* no context established the value is the fail-closed `'unresolved'`.
|
|
82
|
+
*/
|
|
83
|
+
class AuditSink {
|
|
84
|
+
opts;
|
|
85
|
+
queue = [];
|
|
86
|
+
draining = false;
|
|
87
|
+
pendingFlush = null;
|
|
88
|
+
/**
|
|
89
|
+
* FIFO serialisation for every record write. Admission order is chain order;
|
|
90
|
+
* a lane slot is held only for the duration of one append.
|
|
91
|
+
*/
|
|
92
|
+
writeLane = Promise.resolve();
|
|
93
|
+
/** Records admitted but not yet written, queued or straight through. */
|
|
94
|
+
pending = 0;
|
|
95
|
+
overflowPending = 0;
|
|
96
|
+
overflowTotal = 0;
|
|
97
|
+
/** Drops since the last `audit_overflow` record was written. */
|
|
98
|
+
overflowDropped = 0;
|
|
99
|
+
dropped = 0;
|
|
100
|
+
chainInit = null;
|
|
101
|
+
auditKey = null;
|
|
102
|
+
seq = 0;
|
|
103
|
+
lastHash = chain_1.GENESIS_HASH;
|
|
104
|
+
head = null;
|
|
105
|
+
/**
|
|
106
|
+
* Oldest sequence number still on disk. Rotation evicts the oldest archives,
|
|
107
|
+
* so verification starts here instead of at the genesis hash. Monotonic: it is
|
|
108
|
+
* a promise about what the log retains.
|
|
109
|
+
*/
|
|
110
|
+
retainedFromSeq = null;
|
|
111
|
+
/** Highest sequence number already anchored in the floor file. */
|
|
112
|
+
floorSeq = 0;
|
|
113
|
+
floorErrorReported = null;
|
|
114
|
+
chainError = null;
|
|
115
|
+
chainErrorReported = null;
|
|
116
|
+
eventsWritten = 0;
|
|
117
|
+
eventsFailed = 0;
|
|
118
|
+
writeErrorReported = null;
|
|
119
|
+
constructor(opts) {
|
|
120
|
+
const envBuffer = process.env.SW_AGENT_AUDIT_BUFFER;
|
|
121
|
+
const parsedBuffer = envBuffer ? parseInt(envBuffer, 10) : Number.NaN;
|
|
122
|
+
const bufferSize = opts.bufferSize ?? (Number.isFinite(parsedBuffer) ? parsedBuffer : DEFAULT_BUFFER_SIZE);
|
|
123
|
+
const requestedMax = opts.maxQueueItems ?? DEFAULT_MAX_QUEUE_ITEMS;
|
|
124
|
+
this.opts = {
|
|
125
|
+
agentId: opts.agentId,
|
|
126
|
+
localWriter: opts.localWriter,
|
|
127
|
+
cloudWriter: opts.cloudWriter,
|
|
128
|
+
bufferSize,
|
|
129
|
+
// The queue cap is never allowed below the high-water mark it reports, and
|
|
130
|
+
// never zero: a cap below `bufferSize` would drop a record that had not
|
|
131
|
+
// even reached the mark that says pressure started.
|
|
132
|
+
maxQueueItems: Math.max(1, bufferSize, Number.isFinite(requestedMax) && requestedMax > 0
|
|
133
|
+
? Math.floor(requestedMax)
|
|
134
|
+
: DEFAULT_MAX_QUEUE_ITEMS),
|
|
135
|
+
onDrop: opts.onDrop,
|
|
136
|
+
keyDir: opts.keyDir ?? '',
|
|
137
|
+
key: opts.key,
|
|
138
|
+
maxScanRecords: opts.maxScanRecords ?? DEFAULT_MAX_SCAN_RECORDS,
|
|
139
|
+
};
|
|
140
|
+
// Anchor the chain head at every durable commit. The hook receives the
|
|
141
|
+
// newest record that actually reached the disk, so the head can never be
|
|
142
|
+
// written ahead of the data it describes.
|
|
143
|
+
this.opts.localWriter.setCommitListener((last, retainedFromSeq) => this.onDurableCommit(last, retainedFromSeq));
|
|
144
|
+
}
|
|
145
|
+
/** Chain identity, once established. */
|
|
146
|
+
get chainId() {
|
|
147
|
+
return this.auditKey?.chain_id ?? null;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Attribute every audit record written inside `fn` to a resolved database.
|
|
151
|
+
*
|
|
152
|
+
* A thin delegate to the module-level context store, exposed here because the
|
|
153
|
+
* sink is where the contract lives: `log()`/`logSync()` read the identity from
|
|
154
|
+
* that store, so this method is the only supported way to supply one. It does
|
|
155
|
+
* not depend on sink instance state, which is what lets a caller that holds a
|
|
156
|
+
* hand-rolled sink in a test still get the same record shape.
|
|
157
|
+
*/
|
|
158
|
+
withResolvedDatabase(identity, fn) {
|
|
159
|
+
return (0, context_1.withResolvedDatabase)(identity, fn);
|
|
160
|
+
}
|
|
161
|
+
/** Sequence number of the newest record this instance has written. */
|
|
162
|
+
get currentSeq() {
|
|
163
|
+
return this.seq;
|
|
164
|
+
}
|
|
165
|
+
/* ---------------------------------------------------------------- */
|
|
166
|
+
/* Public API */
|
|
167
|
+
/* ---------------------------------------------------------------- */
|
|
168
|
+
/**
|
|
169
|
+
* Fire-and-forget append. The record is written and committed by the next
|
|
170
|
+
* group commit; it is not guaranteed durable when this returns.
|
|
171
|
+
*
|
|
172
|
+
* A record that carries an authorization decision (`allow`/`deny`) bypasses
|
|
173
|
+
* the bounded queue and takes the write lane directly: a decision is never
|
|
174
|
+
* droppable and never waits for queue space. Everything else is queued and is
|
|
175
|
+
* subject to the `maxQueueItems` drop-oldest policy.
|
|
176
|
+
*/
|
|
177
|
+
log(partial) {
|
|
178
|
+
if (isAuthorizationDecision(partial.decision)) {
|
|
179
|
+
void this.writeThrough(partial, false).catch(() => undefined);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
// drain() counts and reports the failure; the catch only keeps the rejection
|
|
183
|
+
// from becoming an unhandled rejection — including the rejection a dropped
|
|
184
|
+
// entry produces, which `reportDrop` has already counted and surfaced.
|
|
185
|
+
void this.enqueueQueued(() => this.record(partial, false)).catch(() => undefined);
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Awaited append. Resolves only once the record (and the chain head that
|
|
189
|
+
* anchors it) is fsync'd. A write failure rejects — audit loss is never
|
|
190
|
+
* swallowed on this path.
|
|
191
|
+
*
|
|
192
|
+
* Never queued: buffer pressure can neither reject this call nor drop the
|
|
193
|
+
* record (finding M-04). The caller waits for its own append, never for queue
|
|
194
|
+
* room, so the wait is bounded by one write rather than by the backlog.
|
|
195
|
+
*/
|
|
196
|
+
async logSync(partial) {
|
|
197
|
+
await this.writeThrough(partial, true);
|
|
198
|
+
}
|
|
199
|
+
async flush() {
|
|
200
|
+
if (this.queue.length > 0 || this.draining || this.pending > 0) {
|
|
201
|
+
await new Promise((resolve) => {
|
|
202
|
+
this.pendingFlush = resolve;
|
|
203
|
+
void this.drain();
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
await this.opts.localWriter.flush();
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Filters the log and verifies the chain in the same streaming pass, so a full
|
|
210
|
+
* history is never materialised (finding M-06).
|
|
211
|
+
*/
|
|
212
|
+
async query(filter) {
|
|
213
|
+
const limit = Math.min(filter.limit ?? 100, 1000);
|
|
214
|
+
const sinceTs = filter.since ? new Date(filter.since).getTime() : null;
|
|
215
|
+
const untilTs = filter.until ? new Date(filter.until).getTime() : null;
|
|
216
|
+
const events = [];
|
|
217
|
+
let total = 0;
|
|
218
|
+
let scanned = 0;
|
|
219
|
+
const verifier = await this.buildVerifier();
|
|
220
|
+
for await (const event of this.opts.localWriter.stream({
|
|
221
|
+
maxRecords: this.opts.maxScanRecords,
|
|
222
|
+
})) {
|
|
223
|
+
scanned++;
|
|
224
|
+
if (verifier && !verifier.failed) {
|
|
225
|
+
verifier.push(event);
|
|
226
|
+
}
|
|
227
|
+
if (!matchesFilter(event, filter, sinceTs, untilTs))
|
|
228
|
+
continue;
|
|
229
|
+
total++;
|
|
230
|
+
if (events.length < limit)
|
|
231
|
+
events.push(event);
|
|
232
|
+
}
|
|
233
|
+
if (!verifier) {
|
|
234
|
+
return {
|
|
235
|
+
events,
|
|
236
|
+
total,
|
|
237
|
+
chain_intact: false,
|
|
238
|
+
chain_reason: this.chainError ? 'chain_broken' : 'key_unavailable',
|
|
239
|
+
chain_detail: this.chainError ?? 'no audit key; the chain could not be verified',
|
|
240
|
+
chain_records: scanned,
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
const result = verifier.result(this.currentAnchor());
|
|
244
|
+
return {
|
|
245
|
+
events,
|
|
246
|
+
total,
|
|
247
|
+
chain_intact: result.intact,
|
|
248
|
+
broken_at: result.brokenAt,
|
|
249
|
+
chain_reason: result.reason,
|
|
250
|
+
chain_detail: result.detail,
|
|
251
|
+
chain_records: result.events,
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* The strongest claim about where the chain ends: this process's head plus the
|
|
256
|
+
* monotonic floor, which a second process (or a restored backup) may have moved
|
|
257
|
+
* further than the in-memory head.
|
|
258
|
+
*/
|
|
259
|
+
currentAnchor() {
|
|
260
|
+
const dir = this.opts.localWriter.dir;
|
|
261
|
+
const resolved = (0, chain_1.resolveAnchor)([
|
|
262
|
+
{ head: this.head, source: 'head.json' },
|
|
263
|
+
{ head: (0, chain_1.readHeadFloor)(dir), source: `head${chain_1.AUDIT_FLOOR_SUFFIX}` },
|
|
264
|
+
]);
|
|
265
|
+
if (resolved.conflict && this.chainError === null) {
|
|
266
|
+
this.chainError = resolved.conflict;
|
|
267
|
+
this.reportChainError(resolved.conflict);
|
|
268
|
+
}
|
|
269
|
+
return resolved.anchor;
|
|
270
|
+
}
|
|
271
|
+
getHealth() {
|
|
272
|
+
return {
|
|
273
|
+
...this.opts.localWriter.getHealth(),
|
|
274
|
+
chain_id: this.auditKey?.chain_id ?? null,
|
|
275
|
+
seq: this.seq,
|
|
276
|
+
retained_from_seq: this.retainedFromSeq,
|
|
277
|
+
chain_error: this.chainError,
|
|
278
|
+
// The bounded queue. This is the sink's own memory footprint, and it is
|
|
279
|
+
// hard-capped at `maxQueueItems`; records that take the write lane directly
|
|
280
|
+
// are held by their caller, not by the sink.
|
|
281
|
+
queue_depth: this.queue.length,
|
|
282
|
+
overflow_admitted: this.overflowTotal,
|
|
283
|
+
dropped: this.dropped,
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
/* ---------------------------------------------------------------- */
|
|
287
|
+
/* Chain management */
|
|
288
|
+
/* ---------------------------------------------------------------- */
|
|
289
|
+
/**
|
|
290
|
+
* Establishes the key and recovers the chain head. Idempotent; the promise is
|
|
291
|
+
* memoised so concurrent appends share one recovery.
|
|
292
|
+
*/
|
|
293
|
+
ensureChain() {
|
|
294
|
+
if (this.chainError) {
|
|
295
|
+
return Promise.reject(new Error(this.chainError));
|
|
296
|
+
}
|
|
297
|
+
if (!this.chainInit) {
|
|
298
|
+
this.chainInit = this.initChain().catch((err) => {
|
|
299
|
+
// A failed attempt is retried on the next append — an unwritable
|
|
300
|
+
// directory is an environment problem, not a chain-integrity problem.
|
|
301
|
+
// A key that cannot be established, however, will not fix itself and is
|
|
302
|
+
// latched so every caller sees the same loud reason.
|
|
303
|
+
this.chainInit = null;
|
|
304
|
+
if (err instanceof chain_1.AuditKeyError) {
|
|
305
|
+
const message = `audit chain not established: ${err.message}`;
|
|
306
|
+
this.chainError = message;
|
|
307
|
+
this.reportChainError(message);
|
|
308
|
+
}
|
|
309
|
+
throw err;
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
return this.chainInit;
|
|
313
|
+
}
|
|
314
|
+
async initChain() {
|
|
315
|
+
const dir = this.opts.localWriter.dir;
|
|
316
|
+
// Repair a directory left untraversable before anything touches it,
|
|
317
|
+
// including the head file.
|
|
318
|
+
await this.opts.localWriter.prepare();
|
|
319
|
+
const head = (0, chain_1.readHead)(dir);
|
|
320
|
+
// The floor is a second, independent claim about the same chain. Either one
|
|
321
|
+
// can be rolled back together with the log; together they cannot.
|
|
322
|
+
const floor = (0, chain_1.readHeadFloor)(dir);
|
|
323
|
+
const anchor = (0, chain_1.resolveAnchor)([
|
|
324
|
+
{ head, source: 'head.json' },
|
|
325
|
+
{ head: floor, source: `head${chain_1.AUDIT_FLOOR_SUFFIX}` },
|
|
326
|
+
]).anchor;
|
|
327
|
+
const key = this.establishKey(anchor);
|
|
328
|
+
this.auditKey = key;
|
|
329
|
+
this.floorSeq = floor && floor.chain_id === key.chain_id ? floor.seq : 0;
|
|
330
|
+
// Recover from the log itself: head.json can be a commit behind after a
|
|
331
|
+
// crash, and a rotated active file may be empty right after a rotation.
|
|
332
|
+
const tail = await this.opts.localWriter.readTailEvent();
|
|
333
|
+
// Reconcile the retention floor with what is actually on disk. `max()`
|
|
334
|
+
// keeps it monotonic and self-heals a crash between the log write and the
|
|
335
|
+
// head write, which legitimately leaves the head behind.
|
|
336
|
+
const onDisk = this.opts.localWriter.getRetentionFloor();
|
|
337
|
+
const anchored = anchor?.retained_from_seq ?? null;
|
|
338
|
+
this.retainedFromSeq = Math.max(anchored ?? 0, onDisk ?? 0) || null;
|
|
339
|
+
if (tail) {
|
|
340
|
+
const problem = this.inspectTail(tail, key);
|
|
341
|
+
if (problem) {
|
|
342
|
+
this.failChain(problem);
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
this.seq = tail.seq;
|
|
346
|
+
this.lastHash = tail.mac;
|
|
347
|
+
if (anchor && anchor.chain_id !== key.chain_id) {
|
|
348
|
+
this.failChain(`anchored head belongs to chain ${anchor.chain_id} but this installation signs with ${key.chain_id}`);
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
if (anchor && anchor.seq > tail.seq) {
|
|
352
|
+
this.failChain(`an anchor is at seq ${anchor.seq} but the log ends at seq ${tail.seq} — the log was truncated or rolled back`);
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
else if (anchor && anchor.seq > 0) {
|
|
357
|
+
this.failChain(`an anchor claims seq ${anchor.seq} but no record is readable — the log was deleted`);
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
else {
|
|
361
|
+
this.seq = 0;
|
|
362
|
+
this.lastHash = chain_1.GENESIS_HASH;
|
|
363
|
+
}
|
|
364
|
+
// Repair/establish the anchors. Written after the durable data, so a crash
|
|
365
|
+
// in between leaves the anchors behind — never ahead.
|
|
366
|
+
this.persistHead(this.seq, this.lastHash, true);
|
|
367
|
+
}
|
|
368
|
+
establishKey(head) {
|
|
369
|
+
const explicit = this.opts.key;
|
|
370
|
+
if (explicit !== undefined && explicit !== null) {
|
|
371
|
+
const bytes = Buffer.isBuffer(explicit) ? explicit : (0, chain_1.decodeKeyMaterial)(explicit);
|
|
372
|
+
return {
|
|
373
|
+
key: bytes,
|
|
374
|
+
chain_id: head?.chain_id ?? (0, chain_1.deriveChainId)(bytes),
|
|
375
|
+
source: 'env',
|
|
376
|
+
origin: 'explicit',
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
return (0, chain_1.loadAuditKey)({
|
|
380
|
+
dir: this.opts.keyDir || undefined,
|
|
381
|
+
create: true,
|
|
382
|
+
chainId: head?.chain_id ?? null,
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Validates the tail record against the key. Returns a problem description,
|
|
387
|
+
* or null when the tail is a legitimate continuation point.
|
|
388
|
+
*/
|
|
389
|
+
inspectTail(tail, key) {
|
|
390
|
+
if (tail.chain_id !== key.chain_id) {
|
|
391
|
+
return `log tail is chain ${tail.chain_id} but this installation signs with ${key.chain_id} — the key was replaced`;
|
|
392
|
+
}
|
|
393
|
+
if (typeof tail.seq !== 'number' || !Number.isInteger(tail.seq) || tail.seq < 1) {
|
|
394
|
+
return 'log tail record has no usable sequence number';
|
|
395
|
+
}
|
|
396
|
+
if (typeof tail.mac !== 'string' || tail.hash !== tail.mac) {
|
|
397
|
+
return 'log tail record is malformed (missing or inconsistent mac)';
|
|
398
|
+
}
|
|
399
|
+
let expected;
|
|
400
|
+
try {
|
|
401
|
+
expected = (0, chain_1.computeMac)((0, chain_1.macInputOf)(tail), key.key);
|
|
402
|
+
}
|
|
403
|
+
catch (err) {
|
|
404
|
+
return `log tail record could not be verified: ${err instanceof Error ? err.message : String(err)}`;
|
|
405
|
+
}
|
|
406
|
+
if (expected !== tail.mac) {
|
|
407
|
+
return 'log tail record does not match its mac — the log has been modified';
|
|
408
|
+
}
|
|
409
|
+
return null;
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Refuses to continue on a chain that does not verify. Throwing here is the
|
|
413
|
+
* point: the alternative — starting a fresh chain in the same file — would
|
|
414
|
+
* silently erase the evidence of the damage.
|
|
415
|
+
*/
|
|
416
|
+
failChain(problem) {
|
|
417
|
+
this.chainError = problem;
|
|
418
|
+
this.reportChainError(problem);
|
|
419
|
+
throw new Error(problem);
|
|
420
|
+
}
|
|
421
|
+
reportChainError(problem) {
|
|
422
|
+
if (this.chainErrorReported === problem)
|
|
423
|
+
return;
|
|
424
|
+
this.chainErrorReported = problem;
|
|
425
|
+
console.error(`[audit] CHAIN BROKEN: ${problem}. Audit records are being REJECTED rather than written to a ` +
|
|
426
|
+
'chain that no longer verifies. Inspect the audit directory and restore from a backup before resuming.');
|
|
427
|
+
}
|
|
428
|
+
onDurableCommit(last, retainedFromSeq) {
|
|
429
|
+
if (!this.auditKey)
|
|
430
|
+
return;
|
|
431
|
+
if (typeof retainedFromSeq === 'number') {
|
|
432
|
+
this.retainedFromSeq =
|
|
433
|
+
this.retainedFromSeq === null
|
|
434
|
+
? retainedFromSeq
|
|
435
|
+
: Math.max(this.retainedFromSeq, retainedFromSeq);
|
|
436
|
+
}
|
|
437
|
+
if (!last)
|
|
438
|
+
return;
|
|
439
|
+
this.persistHead(last.seq, last.mac, true);
|
|
440
|
+
}
|
|
441
|
+
persistHead(seq, lastHash, sync) {
|
|
442
|
+
if (!this.auditKey)
|
|
443
|
+
return;
|
|
444
|
+
const head = (0, chain_1.makeHead)(seq, lastHash, this.auditKey.chain_id, this.retainedFromSeq);
|
|
445
|
+
(0, chain_1.writeHead)(this.opts.localWriter.dir, head, { sync });
|
|
446
|
+
this.head = head;
|
|
447
|
+
// The floor is advanced after the head, so a crash can only leave it behind
|
|
448
|
+
// the log. It is skipped when it is already at or beyond this sequence
|
|
449
|
+
// number, which is every call but the first of a session.
|
|
450
|
+
if (seq <= this.floorSeq)
|
|
451
|
+
return;
|
|
452
|
+
try {
|
|
453
|
+
(0, chain_1.writeHeadFloor)(this.opts.localWriter.dir, head, { sync });
|
|
454
|
+
this.floorSeq = seq;
|
|
455
|
+
}
|
|
456
|
+
catch (err) {
|
|
457
|
+
// The records are durable and `head.json` is anchored; only the second,
|
|
458
|
+
// independent claim is missing. That reduces rollback detection to
|
|
459
|
+
// `head.json` alone — worth saying out loud, but not worth refusing to
|
|
460
|
+
// record anything over, so the memo is left unadvanced and the next commit
|
|
461
|
+
// retries.
|
|
462
|
+
this.reportFloorError(err);
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
reportFloorError(err) {
|
|
466
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
467
|
+
if (this.floorErrorReported === message)
|
|
468
|
+
return;
|
|
469
|
+
this.floorErrorReported = message;
|
|
470
|
+
console.error(`[audit] CHAIN ANCHOR DEGRADED: ${message}. Records are still being written and head.json is still ` +
|
|
471
|
+
'anchored, but detecting a rollback now relies on head.json alone. Fix the anchor file and this ' +
|
|
472
|
+
'recovers on the next record.');
|
|
473
|
+
}
|
|
474
|
+
buildEvent(partial) {
|
|
475
|
+
const key = this.auditKey;
|
|
476
|
+
if (!key) {
|
|
477
|
+
throw new Error('audit chain key is not established');
|
|
478
|
+
}
|
|
479
|
+
const seq = this.seq + 1;
|
|
480
|
+
const prev_hash = this.lastHash;
|
|
481
|
+
// The resolved identity comes from the request context, never from the
|
|
482
|
+
// call site. With no context established this is the fail-closed
|
|
483
|
+
// `'unresolved'` value: a record must never claim a database it did not
|
|
484
|
+
// resolve.
|
|
485
|
+
const identity = (0, context_1.currentResolvedDbIdentity)();
|
|
486
|
+
const base = {
|
|
487
|
+
id: partial.id || crypto.randomUUID(),
|
|
488
|
+
ts: new Date().toISOString(),
|
|
489
|
+
agent_id: this.opts.agentId,
|
|
490
|
+
project: partial.project,
|
|
491
|
+
resolved_db_alias: identity.resolved_db_alias,
|
|
492
|
+
resolved_database: identity.resolved_database,
|
|
493
|
+
user_id: partial.user_id,
|
|
494
|
+
actor: partial.actor ?? 'user',
|
|
495
|
+
role: partial.role,
|
|
496
|
+
action: partial.action,
|
|
497
|
+
decision: partial.decision,
|
|
498
|
+
outcome: partial.outcome,
|
|
499
|
+
permission_level: partial.permission_level,
|
|
500
|
+
seq,
|
|
501
|
+
chain_id: key.chain_id,
|
|
502
|
+
prev_hash,
|
|
503
|
+
};
|
|
504
|
+
// Optional fields are only set when present: an explicit `undefined` would
|
|
505
|
+
// canonicalise differently before and after the JSON round trip, and the
|
|
506
|
+
// MAC would then never verify.
|
|
507
|
+
const event = { ...base, mac: '', hash: '' };
|
|
508
|
+
if (partial.db_alias_asserted !== undefined)
|
|
509
|
+
event.db_alias_asserted = partial.db_alias_asserted;
|
|
510
|
+
if (partial.statement_fingerprint !== undefined)
|
|
511
|
+
event.statement_fingerprint = partial.statement_fingerprint;
|
|
512
|
+
if (partial.statement_preview !== undefined)
|
|
513
|
+
event.statement_preview = partial.statement_preview;
|
|
514
|
+
if (partial.denial_reason !== undefined)
|
|
515
|
+
event.denial_reason = partial.denial_reason;
|
|
516
|
+
if (partial.error_code !== undefined)
|
|
517
|
+
event.error_code = partial.error_code;
|
|
518
|
+
if (partial.duration_ms !== undefined)
|
|
519
|
+
event.duration_ms = partial.duration_ms;
|
|
520
|
+
if (partial.rows_affected !== undefined)
|
|
521
|
+
event.rows_affected = partial.rows_affected;
|
|
522
|
+
if (partial.rows_returned !== undefined)
|
|
523
|
+
event.rows_returned = partial.rows_returned;
|
|
524
|
+
if (partial.migration_plan_id !== undefined)
|
|
525
|
+
event.migration_plan_id = partial.migration_plan_id;
|
|
526
|
+
if (partial.cancel_target_user_id !== undefined)
|
|
527
|
+
event.cancel_target_user_id = partial.cancel_target_user_id;
|
|
528
|
+
if (partial.cancel_target_project !== undefined)
|
|
529
|
+
event.cancel_target_project = partial.cancel_target_project;
|
|
530
|
+
if (partial.cancel_target_db_alias !== undefined)
|
|
531
|
+
event.cancel_target_db_alias = partial.cancel_target_db_alias;
|
|
532
|
+
const mac = (0, chain_1.computeMac)(event, key.key);
|
|
533
|
+
event.mac = mac;
|
|
534
|
+
event.hash = mac;
|
|
535
|
+
return event;
|
|
536
|
+
}
|
|
537
|
+
async record(partial, durable) {
|
|
538
|
+
await this.ensureChain();
|
|
539
|
+
const event = this.buildEvent(partial);
|
|
540
|
+
await this.opts.localWriter.append(event, { durable });
|
|
541
|
+
this.seq = event.seq;
|
|
542
|
+
this.lastHash = event.mac;
|
|
543
|
+
this.eventsWritten++;
|
|
544
|
+
this.writeErrorReported = null;
|
|
545
|
+
void this.opts.cloudWriter.log(event).catch((err) => {
|
|
546
|
+
console.error('[audit] cloud write failed:', err);
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
async buildVerifier() {
|
|
550
|
+
try {
|
|
551
|
+
await this.ensureChain();
|
|
552
|
+
}
|
|
553
|
+
catch {
|
|
554
|
+
return null;
|
|
555
|
+
}
|
|
556
|
+
if (!this.auditKey)
|
|
557
|
+
return null;
|
|
558
|
+
return new chain_1.ChainVerifier(this.auditKey.key, {
|
|
559
|
+
chainId: this.auditKey.chain_id,
|
|
560
|
+
expectedSeq: this.retainedFromSeq ?? 1,
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
/* ---------------------------------------------------------------- */
|
|
564
|
+
/* Queue and write lane */
|
|
565
|
+
/* ---------------------------------------------------------------- */
|
|
566
|
+
/**
|
|
567
|
+
* Serialises every record write. This is what keeps `seq`, `prev_hash` and the
|
|
568
|
+
* anchored head consistent, and it is FIFO, so records enter the chain in
|
|
569
|
+
* admission order.
|
|
570
|
+
*
|
|
571
|
+
* A lane slot is held for the duration of one append only, which is what lets
|
|
572
|
+
* a decision record overtake queued telemetry instead of waiting behind it.
|
|
573
|
+
*/
|
|
574
|
+
runInWriteLane(fn) {
|
|
575
|
+
const next = this.writeLane.then(fn, fn);
|
|
576
|
+
this.writeLane = next.then(() => undefined, () => undefined);
|
|
577
|
+
return next;
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* Records an admission: takes a slot in the outstanding-work count and, if
|
|
581
|
+
* the high-water mark is already exceeded, books an overflow admission. Every
|
|
582
|
+
* entry point (queued or straight through) goes through here, so the reported
|
|
583
|
+
* count describes the real backlog rather than one particular lane.
|
|
584
|
+
*/
|
|
585
|
+
admit() {
|
|
586
|
+
if (this.pending >= this.opts.bufferSize) {
|
|
587
|
+
this.overflowPending++;
|
|
588
|
+
}
|
|
589
|
+
this.pending++;
|
|
590
|
+
}
|
|
591
|
+
/**
|
|
592
|
+
* The guaranteed path: straight to the write lane, never queued.
|
|
593
|
+
*
|
|
594
|
+
* Nothing here can be dropped or rejected for buffer pressure, and the caller
|
|
595
|
+
* never waits for queue room — only for its own append.
|
|
596
|
+
*/
|
|
597
|
+
async writeThrough(partial, durable) {
|
|
598
|
+
this.admit();
|
|
599
|
+
try {
|
|
600
|
+
await this.runInWriteLane(() => this.record(partial, durable));
|
|
601
|
+
}
|
|
602
|
+
finally {
|
|
603
|
+
this.pending--;
|
|
604
|
+
try {
|
|
605
|
+
await this.reportOverflowIfDue();
|
|
606
|
+
}
|
|
607
|
+
finally {
|
|
608
|
+
this.settleIfIdle();
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Queues a fire-and-forget, non-decision record.
|
|
614
|
+
*
|
|
615
|
+
* A full queue is *not* an error and never rejects the caller for pressure:
|
|
616
|
+
* the **oldest** entries are dropped to make room (drop-oldest, matching
|
|
617
|
+
* `CloudClient.maxQueueItems`, finding M-07) and every drop is counted,
|
|
618
|
+
* logged, persisted and handed to `onDrop`. Rejecting in-flight callers
|
|
619
|
+
* instead turned buffer pressure into a global query-kill switch and dropped
|
|
620
|
+
* the denial records that matter most (finding M-04).
|
|
621
|
+
*
|
|
622
|
+
* Only records that carry no authorization decision reach here — see
|
|
623
|
+
* {@link AuditSink.log} — so the eviction can never touch an allow/deny.
|
|
624
|
+
*/
|
|
625
|
+
enqueueQueued(work) {
|
|
626
|
+
return new Promise((resolve, reject) => {
|
|
627
|
+
if (this.queue.length >= this.opts.maxQueueItems) {
|
|
628
|
+
const excess = this.queue.length - this.opts.maxQueueItems + 1;
|
|
629
|
+
const evicted = this.queue.splice(0, excess);
|
|
630
|
+
this.pending -= evicted.length;
|
|
631
|
+
this.reportDrop({
|
|
632
|
+
count: evicted.length,
|
|
633
|
+
reason: 'queue_overflow',
|
|
634
|
+
queueDepth: this.queue.length,
|
|
635
|
+
maxQueueItems: this.opts.maxQueueItems,
|
|
636
|
+
});
|
|
637
|
+
for (const entry of evicted) {
|
|
638
|
+
entry.reject(new Error(`audit queue overflow: ${evicted.length} queued record(s) dropped to stay within ` +
|
|
639
|
+
`maxQueueItems=${this.opts.maxQueueItems}`));
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
this.admit();
|
|
643
|
+
this.queue.push({ work, resolve, reject });
|
|
644
|
+
void this.drain();
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* Single serial worker for the queue.
|
|
649
|
+
*
|
|
650
|
+
* Work queued while the worker is shutting down must not be lost: the queue is
|
|
651
|
+
* re-checked immediately after `draining` is cleared, with no `await` in
|
|
652
|
+
* between, so an entry can never be stranded with nobody left to run it.
|
|
653
|
+
*/
|
|
654
|
+
async drain() {
|
|
655
|
+
if (this.draining)
|
|
656
|
+
return;
|
|
657
|
+
this.draining = true;
|
|
658
|
+
try {
|
|
659
|
+
while (this.queue.length > 0) {
|
|
660
|
+
const entry = this.queue.shift();
|
|
661
|
+
try {
|
|
662
|
+
// Through the lane, one slot at a time: a decision record admitted
|
|
663
|
+
// while this entry waited goes in ahead of it rather than behind the
|
|
664
|
+
// whole backlog.
|
|
665
|
+
await this.runInWriteLane(entry.work);
|
|
666
|
+
entry.resolve();
|
|
667
|
+
}
|
|
668
|
+
catch (err) {
|
|
669
|
+
this.eventsFailed++;
|
|
670
|
+
this.reportWriteError(err);
|
|
671
|
+
entry.reject(err);
|
|
672
|
+
}
|
|
673
|
+
finally {
|
|
674
|
+
this.pending--;
|
|
675
|
+
}
|
|
676
|
+
await this.reportOverflowIfDue();
|
|
677
|
+
}
|
|
678
|
+
await this.reportOverflowIfDue(true);
|
|
679
|
+
}
|
|
680
|
+
finally {
|
|
681
|
+
// No `await` between clearing `draining` and re-checking the queue: an
|
|
682
|
+
// entry queued while the worker was shutting down can never be stranded.
|
|
683
|
+
this.draining = false;
|
|
684
|
+
if (this.queue.length > 0) {
|
|
685
|
+
void this.drain();
|
|
686
|
+
}
|
|
687
|
+
else {
|
|
688
|
+
this.settleIfIdle();
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
/**
|
|
693
|
+
* Releases a waiting `flush()` once nothing is outstanding — no queued entry,
|
|
694
|
+
* no write in flight. Straight-through records call this as they settle, so a
|
|
695
|
+
* flush cannot return while a decision record is still being written.
|
|
696
|
+
*/
|
|
697
|
+
settleIfIdle() {
|
|
698
|
+
if (!this.pendingFlush)
|
|
699
|
+
return;
|
|
700
|
+
if (this.draining || this.queue.length > 0 || this.pending > 0)
|
|
701
|
+
return;
|
|
702
|
+
const resolve = this.pendingFlush;
|
|
703
|
+
this.pendingFlush = null;
|
|
704
|
+
resolve();
|
|
705
|
+
}
|
|
706
|
+
/**
|
|
707
|
+
* Writes the queue-pressure record: how many records were admitted above the
|
|
708
|
+
* high-water mark, and how many were dropped outright. Both numbers are read
|
|
709
|
+
* before they are reset (the previous code reset first, so the record always
|
|
710
|
+
* reported the wrong number).
|
|
711
|
+
*/
|
|
712
|
+
async reportOverflowIfDue(final = false) {
|
|
713
|
+
if (this.overflowPending === 0 && this.overflowDropped === 0)
|
|
714
|
+
return;
|
|
715
|
+
if (!final &&
|
|
716
|
+
this.pending >= this.opts.bufferSize &&
|
|
717
|
+
this.overflowPending + this.overflowDropped < OVERFLOW_REPORT_THRESHOLD) {
|
|
718
|
+
return;
|
|
719
|
+
}
|
|
720
|
+
const admitted = this.overflowPending;
|
|
721
|
+
const dropped = this.overflowDropped;
|
|
722
|
+
this.overflowPending = 0;
|
|
723
|
+
this.overflowDropped = 0;
|
|
724
|
+
this.overflowTotal += admitted;
|
|
725
|
+
const event = {
|
|
726
|
+
actor: 'system',
|
|
727
|
+
action: 'audit_overflow',
|
|
728
|
+
decision: 'deny',
|
|
729
|
+
outcome: 'n/a',
|
|
730
|
+
denial_reason: 'buffer_overflow',
|
|
731
|
+
project: '__system__',
|
|
732
|
+
user_id: '__system__',
|
|
733
|
+
role: 'system',
|
|
734
|
+
permission_level: 'unknown',
|
|
735
|
+
statement_preview: `${admitted} audit records were admitted above the queue high-water mark of ${this.opts.bufferSize}; ` +
|
|
736
|
+
`${dropped} were dropped, and every allow/deny decision record is written straight through and never dropped`,
|
|
737
|
+
};
|
|
738
|
+
this.pending++;
|
|
739
|
+
try {
|
|
740
|
+
await this.runInWriteLane(() => this.record(event, false));
|
|
741
|
+
}
|
|
742
|
+
catch (err) {
|
|
743
|
+
// The overflow record is itself audit data; if it cannot be written the
|
|
744
|
+
// write error is already surfaced by record()'s caller path.
|
|
745
|
+
this.reportWriteError(err);
|
|
746
|
+
}
|
|
747
|
+
finally {
|
|
748
|
+
this.pending--;
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
/**
|
|
752
|
+
* Counts a drop, says so out loud, and hands it to the `onDrop` marker hook —
|
|
753
|
+
* the same contract as `CloudClient.onDrop`. Audit loss is counted and
|
|
754
|
+
* reported, never discarded quietly.
|
|
755
|
+
*/
|
|
756
|
+
reportDrop(drop) {
|
|
757
|
+
this.dropped += drop.count;
|
|
758
|
+
this.overflowDropped += drop.count;
|
|
759
|
+
if (this.dropped === drop.count || this.dropped % DROP_REPORT_INTERVAL === 0) {
|
|
760
|
+
console.error(`[audit] dropped ${drop.count} queued record(s) (${drop.reason}); queue at ` +
|
|
761
|
+
`${drop.queueDepth}/${drop.maxQueueItems}, total dropped ${this.dropped}. Authorization ` +
|
|
762
|
+
'decisions (allow/deny) are never queued, so no decision record is dropped this way.');
|
|
763
|
+
}
|
|
764
|
+
try {
|
|
765
|
+
this.opts.onDrop?.(drop);
|
|
766
|
+
}
|
|
767
|
+
catch (err) {
|
|
768
|
+
console.error('[audit] drop marker hook failed:', err);
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
/**
|
|
772
|
+
* Complains once per distinct failure so audit loss is never silent. The
|
|
773
|
+
* writer already announced a persistence failure, so this stays quiet rather
|
|
774
|
+
* than printing the same problem twice.
|
|
775
|
+
*/
|
|
776
|
+
reportWriteError(err) {
|
|
777
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
778
|
+
if (this.writeErrorReported === message)
|
|
779
|
+
return;
|
|
780
|
+
this.writeErrorReported = message;
|
|
781
|
+
if (this.opts.localWriter.getHealth().last_error === message)
|
|
782
|
+
return;
|
|
783
|
+
console.error(`[audit] write failed: ${message}. Audit records are being LOST. ` +
|
|
784
|
+
'Check sw-agent status / the audit directory.');
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
exports.AuditSink = AuditSink;
|
|
788
|
+
/**
|
|
789
|
+
* Whether `decision` is an authorization decision — the records that carry the
|
|
790
|
+
* security-relevant "this was permitted / this was refused" claim.
|
|
791
|
+
*
|
|
792
|
+
* These are never queued, so no queue policy can drop them. Everything else
|
|
793
|
+
* (`pending`/`approved`/`rejected`/`expired`, i.e. manual-approval lifecycle
|
|
794
|
+
* telemetry) is queueable and droppable under sustained pressure.
|
|
795
|
+
*/
|
|
796
|
+
function isAuthorizationDecision(decision) {
|
|
797
|
+
return decision === 'allow' || decision === 'deny';
|
|
798
|
+
}
|
|
799
|
+
function matchesFilter(event, filter, sinceTs, untilTs) {
|
|
800
|
+
if (filter.project && event.project !== filter.project)
|
|
801
|
+
return false;
|
|
802
|
+
if (filter.user_id && event.user_id !== filter.user_id)
|
|
803
|
+
return false;
|
|
804
|
+
if (filter.action && event.action !== filter.action)
|
|
805
|
+
return false;
|
|
806
|
+
if (filter.decision && event.decision !== filter.decision)
|
|
807
|
+
return false;
|
|
808
|
+
if (filter.outcome && event.outcome !== filter.outcome)
|
|
809
|
+
return false;
|
|
810
|
+
if (sinceTs !== null || untilTs !== null) {
|
|
811
|
+
const ts = new Date(event.ts).getTime();
|
|
812
|
+
if (sinceTs !== null && ts < sinceTs)
|
|
813
|
+
return false;
|
|
814
|
+
if (untilTs !== null && ts >= untilTs)
|
|
815
|
+
return false;
|
|
816
|
+
}
|
|
817
|
+
return true;
|
|
818
|
+
}
|
|
819
|
+
//# sourceMappingURL=sink.js.map
|