@resolveio/server-lib 22.3.150 → 22.3.151
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/ai/assistant-core-heuristics.d.ts +11 -0
- package/ai/assistant-core-heuristics.js +356 -0
- package/ai/assistant-core-heuristics.js.map +1 -0
- package/ai/resolveio-platform-intelligence-memory-corpus.d.ts +3 -0
- package/ai/resolveio-platform-intelligence-memory-corpus.js +214 -0
- package/ai/resolveio-platform-intelligence-memory-corpus.js.map +1 -0
- package/ai/resolveio-platform-intelligence-memory.d.ts +20 -0
- package/ai/resolveio-platform-intelligence-memory.js +341 -0
- package/ai/resolveio-platform-intelligence-memory.js.map +1 -0
- package/{src/ai/resolveio-platform-intelligence-types.ts → ai/resolveio-platform-intelligence-types.d.ts} +15 -20
- package/ai/resolveio-platform-intelligence-types.js +4 -0
- package/ai/resolveio-platform-intelligence-types.js.map +1 -0
- package/ai/resolveio-platform-intelligence.d.ts +6 -0
- package/ai/resolveio-platform-intelligence.js +463 -0
- package/ai/resolveio-platform-intelligence.js.map +1 -0
- package/client-server-app.d.ts +1 -0
- package/client-server-app.js +68 -0
- package/client-server-app.js.map +1 -0
- package/collections/ai-run.collection.d.ts +3 -0
- package/collections/ai-run.collection.js +170 -0
- package/collections/ai-run.collection.js.map +1 -0
- package/collections/ai-terminal-conversation.collection.d.ts +2 -0
- package/collections/ai-terminal-conversation.collection.js +140 -0
- package/collections/ai-terminal-conversation.collection.js.map +1 -0
- package/collections/ai-terminal-issue-report.collection.d.ts +2 -0
- package/collections/ai-terminal-issue-report.collection.js +148 -0
- package/collections/ai-terminal-issue-report.collection.js.map +1 -0
- package/collections/ai-terminal-message.collection.d.ts +2 -0
- package/collections/ai-terminal-message.collection.js +121 -0
- package/collections/ai-terminal-message.collection.js.map +1 -0
- package/collections/app-setting.collection.d.ts +3 -0
- package/collections/app-setting.collection.js +103 -0
- package/collections/app-setting.collection.js.map +1 -0
- package/collections/app-status.collection.d.ts +3 -0
- package/collections/app-status.collection.js +57 -0
- package/collections/app-status.collection.js.map +1 -0
- package/collections/communication-metric.collection.d.ts +2 -0
- package/collections/communication-metric.collection.js +133 -0
- package/collections/communication-metric.collection.js.map +1 -0
- package/collections/counter.collection.d.ts +3 -0
- package/collections/counter.collection.js +56 -0
- package/collections/counter.collection.js.map +1 -0
- package/collections/cron-job-history.collection.d.ts +3 -0
- package/collections/cron-job-history.collection.js +137 -0
- package/collections/cron-job-history.collection.js.map +1 -0
- package/collections/cron-job.collection.d.ts +3 -0
- package/collections/cron-job.collection.js +92 -0
- package/collections/cron-job.collection.js.map +1 -0
- package/collections/customer-notification.collection.d.ts +3 -0
- package/collections/customer-notification.collection.js +130 -0
- package/collections/customer-notification.collection.js.map +1 -0
- package/collections/customer-portal-password.collection.d.ts +3 -0
- package/collections/customer-portal-password.collection.js +75 -0
- package/collections/customer-portal-password.collection.js.map +1 -0
- package/collections/email-history.collection.d.ts +3 -0
- package/collections/email-history.collection.js +134 -0
- package/collections/email-history.collection.js.map +1 -0
- package/collections/email-verified.collection.d.ts +3 -0
- package/collections/email-verified.collection.js +62 -0
- package/collections/email-verified.collection.js.map +1 -0
- package/collections/file.collection.d.ts +3 -0
- package/collections/file.collection.js +74 -0
- package/collections/file.collection.js.map +1 -0
- package/collections/flag-update.collection.d.ts +3 -0
- package/collections/flag-update.collection.js +57 -0
- package/collections/flag-update.collection.js.map +1 -0
- package/collections/flag.collection.d.ts +3 -0
- package/collections/flag.collection.js +57 -0
- package/collections/flag.collection.js.map +1 -0
- package/collections/log-method-latency.collection.d.ts +3 -0
- package/collections/log-method-latency.collection.js +77 -0
- package/collections/log-method-latency.collection.js.map +1 -0
- package/collections/log-subscription.collection.d.ts +3 -0
- package/collections/log-subscription.collection.js +80 -0
- package/collections/log-subscription.collection.js.map +1 -0
- package/collections/log.collection.d.ts +3 -0
- package/collections/log.collection.js +93 -0
- package/collections/log.collection.js.map +1 -0
- package/collections/logged-in-users.collection.d.ts +3 -0
- package/collections/logged-in-users.collection.js +67 -0
- package/collections/logged-in-users.collection.js.map +1 -0
- package/collections/monitor-cpu.collection.d.ts +3 -0
- package/collections/monitor-cpu.collection.js +65 -0
- package/collections/monitor-cpu.collection.js.map +1 -0
- package/collections/monitor-function.collection.d.ts +3 -0
- package/collections/monitor-function.collection.js +74 -0
- package/collections/monitor-function.collection.js.map +1 -0
- package/collections/monitor-memory.collection.d.ts +3 -0
- package/collections/monitor-memory.collection.js +77 -0
- package/collections/monitor-memory.collection.js.map +1 -0
- package/collections/monitor-mongo.collection.d.ts +3 -0
- package/collections/monitor-mongo.collection.js +71 -0
- package/collections/monitor-mongo.collection.js.map +1 -0
- package/collections/notification.collection.d.ts +3 -0
- package/collections/notification.collection.js +57 -0
- package/collections/notification.collection.js.map +1 -0
- package/collections/openai-usage-ledger.collection.d.ts +2 -0
- package/collections/openai-usage-ledger.collection.js +188 -0
- package/collections/openai-usage-ledger.collection.js.map +1 -0
- package/collections/report-builder-dashboard-builder.collection.d.ts +3 -0
- package/collections/report-builder-dashboard-builder.collection.js +109 -0
- package/collections/report-builder-dashboard-builder.collection.js.map +1 -0
- package/collections/report-builder-library.collection.d.ts +3 -0
- package/collections/report-builder-library.collection.js +87 -0
- package/collections/report-builder-library.collection.js.map +1 -0
- package/collections/report-builder-report.collection.d.ts +4 -0
- package/collections/report-builder-report.collection.js +184 -0
- package/collections/report-builder-report.collection.js.map +1 -0
- package/collections/user-group.collection.d.ts +4 -0
- package/collections/user-group.collection.js +89 -0
- package/collections/user-group.collection.js.map +1 -0
- package/collections/user-guide.collection.d.ts +3 -0
- package/collections/user-guide.collection.js +57 -0
- package/collections/user-guide.collection.js.map +1 -0
- package/collections/user.collection.d.ts +4 -0
- package/collections/user.collection.js +180 -0
- package/collections/user.collection.js.map +1 -0
- package/cron/cron.d.ts +14 -0
- package/cron/cron.js +216 -0
- package/cron/cron.js.map +1 -0
- package/fixtures/cron-jobs.d.ts +1 -0
- package/fixtures/cron-jobs.js +150 -0
- package/fixtures/cron-jobs.js.map +1 -0
- package/fixtures/init.d.ts +1 -0
- package/fixtures/init.js +91 -0
- package/fixtures/init.js.map +1 -0
- package/http/auth.d.ts +2 -0
- package/http/auth.js +951 -0
- package/http/auth.js.map +1 -0
- package/http/health.d.ts +1 -0
- package/http/health.js +11 -0
- package/http/health.js.map +1 -0
- package/http/home.d.ts +1 -0
- package/http/home.js +134 -0
- package/http/home.js.map +1 -0
- package/http/slow-query-publication.d.ts +2 -0
- package/http/slow-query-publication.js +99 -0
- package/http/slow-query-publication.js.map +1 -0
- package/index.d.ts +1 -0
- package/index.js +19 -0
- package/index.js.map +1 -0
- package/managers/ai-assistant-codex-manager.manager.d.ts +67 -0
- package/managers/ai-assistant-codex-manager.manager.js +1113 -0
- package/managers/ai-assistant-codex-manager.manager.js.map +1 -0
- package/managers/ai-run-evidence.manager.d.ts +36 -0
- package/managers/ai-run-evidence.manager.js +377 -0
- package/managers/ai-run-evidence.manager.js.map +1 -0
- package/managers/communication-metric.manager.d.ts +16 -0
- package/managers/communication-metric.manager.js +134 -0
- package/managers/communication-metric.manager.js.map +1 -0
- package/managers/cron.manager.d.ts +20 -0
- package/managers/cron.manager.js +534 -0
- package/managers/cron.manager.js.map +1 -0
- package/managers/customer-notification-content.manager.d.ts +55 -0
- package/managers/customer-notification-content.manager.js +158 -0
- package/managers/customer-notification-content.manager.js.map +1 -0
- package/managers/diagnostic-manager-bootstrap.d.ts +9 -0
- package/managers/diagnostic-manager-bootstrap.js +260 -0
- package/managers/diagnostic-manager-bootstrap.js.map +1 -0
- package/managers/error-auto-fix.manager.d.ts +149 -0
- package/managers/error-auto-fix.manager.js +3064 -0
- package/managers/error-auto-fix.manager.js.map +1 -0
- package/managers/local-log.manager.d.ts +18 -0
- package/managers/local-log.manager.js +88 -0
- package/managers/local-log.manager.js.map +1 -0
- package/managers/method.manager.d.ts +84 -0
- package/managers/method.manager.js +1964 -0
- package/managers/method.manager.js.map +1 -0
- package/managers/mongo.manager.d.ts +224 -0
- package/managers/mongo.manager.js +5000 -0
- package/managers/mongo.manager.js.map +1 -0
- package/managers/monitor.manager.d.ts +70 -0
- package/managers/monitor.manager.js +550 -0
- package/managers/monitor.manager.js.map +1 -0
- package/managers/openai-usage-ledger.manager.d.ts +30 -0
- package/managers/openai-usage-ledger.manager.js +142 -0
- package/managers/openai-usage-ledger.manager.js.map +1 -0
- package/managers/slow-query-verifier.manager.d.ts +144 -0
- package/managers/slow-query-verifier.manager.js +3857 -0
- package/managers/slow-query-verifier.manager.js.map +1 -0
- package/managers/slow-query.manager.d.ts +28 -0
- package/managers/slow-query.manager.js +468 -0
- package/managers/slow-query.manager.js.map +1 -0
- package/managers/subscription.manager.d.ts +169 -0
- package/managers/subscription.manager.js +3434 -0
- package/managers/subscription.manager.js.map +1 -0
- package/managers/websocket.manager.d.ts +73 -0
- package/managers/websocket.manager.js +673 -0
- package/managers/websocket.manager.js.map +1 -0
- package/managers/worker-dispatcher.manager.d.ts +120 -0
- package/managers/worker-dispatcher.manager.js +1266 -0
- package/managers/worker-dispatcher.manager.js.map +1 -0
- package/managers/worker-server.manager.d.ts +35 -0
- package/managers/worker-server.manager.js +582 -0
- package/managers/worker-server.manager.js.map +1 -0
- package/methods/accounts.d.ts +2 -0
- package/methods/accounts.js +624 -0
- package/methods/accounts.js.map +1 -0
- package/methods/ai-terminal.d.ts +337 -0
- package/methods/ai-terminal.js +23193 -0
- package/methods/ai-terminal.js.map +1 -0
- package/methods/app-settings.d.ts +2 -0
- package/methods/app-settings.js +169 -0
- package/methods/app-settings.js.map +1 -0
- package/methods/aws.d.ts +2 -0
- package/methods/aws.js +877 -0
- package/methods/aws.js.map +1 -0
- package/methods/collections.d.ts +2 -0
- package/methods/collections.js +719 -0
- package/methods/collections.js.map +1 -0
- package/methods/counters.d.ts +2 -0
- package/methods/counters.js +113 -0
- package/methods/counters.js.map +1 -0
- package/methods/cron-jobs.d.ts +2 -0
- package/methods/cron-jobs.js +2475 -0
- package/methods/cron-jobs.js.map +1 -0
- package/methods/customer-notifications.d.ts +2 -0
- package/methods/customer-notifications.js +528 -0
- package/methods/customer-notifications.js.map +1 -0
- package/methods/diagnostics.d.ts +2 -0
- package/methods/diagnostics.js +703 -0
- package/methods/diagnostics.js.map +1 -0
- package/methods/flag-updates.d.ts +2 -0
- package/methods/flag-updates.js +8 -0
- package/methods/flag-updates.js.map +1 -0
- package/methods/flags.d.ts +2 -0
- package/methods/flags.js +8 -0
- package/methods/flags.js.map +1 -0
- package/methods/logs.d.ts +2 -0
- package/methods/logs.js +751 -0
- package/methods/logs.js.map +1 -0
- package/methods/mongo-explorer.d.ts +2 -0
- package/methods/mongo-explorer.js +1808 -0
- package/methods/mongo-explorer.js.map +1 -0
- package/methods/monitor.d.ts +2 -0
- package/methods/monitor.js +543 -0
- package/methods/monitor.js.map +1 -0
- package/methods/pdf.d.ts +2 -0
- package/methods/pdf.js +1216 -0
- package/methods/pdf.js.map +1 -0
- package/methods/publications.d.ts +1 -0
- package/methods/publications.js +183 -0
- package/methods/publications.js.map +1 -0
- package/methods/report-builder.d.ts +2 -0
- package/methods/report-builder.js +3094 -0
- package/methods/report-builder.js.map +1 -0
- package/methods/support.d.ts +2 -0
- package/methods/support.js +430 -0
- package/methods/support.js.map +1 -0
- package/models/ai-run.model.d.ts +19 -0
- package/models/ai-run.model.js +4 -0
- package/models/ai-run.model.js.map +1 -0
- package/models/ai-terminal-conversation.model.d.ts +17 -0
- package/models/ai-terminal-conversation.model.js +4 -0
- package/models/ai-terminal-conversation.model.js.map +1 -0
- package/models/ai-terminal-issue-report.model.d.ts +19 -0
- package/models/ai-terminal-issue-report.model.js +4 -0
- package/models/ai-terminal-issue-report.model.js.map +1 -0
- package/models/ai-terminal-message.model.d.ts +22 -0
- package/models/ai-terminal-message.model.js +4 -0
- package/models/ai-terminal-message.model.js.map +1 -0
- package/models/app-setting.model.d.ts +16 -0
- package/models/app-setting.model.js +4 -0
- package/models/app-setting.model.js.map +1 -0
- package/{src/models/app-status.model.ts → models/app-status.model.d.ts} +2 -3
- package/models/app-status.model.js +4 -0
- package/models/app-status.model.js.map +1 -0
- package/{src/models/billing-logged-in-users.model.ts → models/billing-logged-in-users.model.d.ts} +4 -5
- package/models/billing-logged-in-users.model.js +4 -0
- package/models/billing-logged-in-users.model.js.map +1 -0
- package/models/collection-document.model.d.ts +21 -0
- package/models/collection-document.model.js +4 -0
- package/models/collection-document.model.js.map +1 -0
- package/models/communication-metric.model.d.ts +20 -0
- package/models/communication-metric.model.js +4 -0
- package/models/communication-metric.model.js.map +1 -0
- package/{src/models/counter.model.ts → models/counter.model.d.ts} +3 -4
- package/models/counter.model.js +4 -0
- package/models/counter.model.js.map +1 -0
- package/models/cron-job-history.model.d.ts +15 -0
- package/models/cron-job-history.model.js +4 -0
- package/models/cron-job-history.model.js.map +1 -0
- package/models/cron-job.model.d.ts +14 -0
- package/models/cron-job.model.js +4 -0
- package/models/cron-job.model.js.map +1 -0
- package/models/customer-notification.model.d.ts +26 -0
- package/models/customer-notification.model.js +4 -0
- package/models/customer-notification.model.js.map +1 -0
- package/models/customer-portal-password.model.d.ts +11 -0
- package/models/customer-portal-password.model.js +4 -0
- package/models/customer-portal-password.model.js.map +1 -0
- package/models/dialog.model.d.ts +23 -0
- package/models/dialog.model.js +4 -0
- package/models/dialog.model.js.map +1 -0
- package/models/email-history.model.d.ts +32 -0
- package/{src/models/email-history.model.ts → models/email-history.model.js} +4 -36
- package/models/email-history.model.js.map +1 -0
- package/{src/models/email-verified.model.ts → models/email-verified.model.d.ts} +5 -6
- package/models/email-verified.model.js +4 -0
- package/models/email-verified.model.js.map +1 -0
- package/{src/models/file.model.ts → models/file.model.d.ts} +7 -8
- package/models/file.model.js +4 -0
- package/models/file.model.js.map +1 -0
- package/{src/models/flag-update.model.ts → models/flag-update.model.d.ts} +3 -4
- package/models/flag-update.model.js +4 -0
- package/models/flag-update.model.js.map +1 -0
- package/{src/models/flag.model.ts → models/flag.model.d.ts} +3 -4
- package/models/flag.model.js +4 -0
- package/models/flag.model.js.map +1 -0
- package/models/log-method-latency.model.d.ts +10 -0
- package/models/log-method-latency.model.js +4 -0
- package/models/log-method-latency.model.js.map +1 -0
- package/{src/models/log-subscription.model.ts → models/log-subscription.model.d.ts} +9 -11
- package/models/log-subscription.model.js +4 -0
- package/models/log-subscription.model.js.map +1 -0
- package/models/log.model.d.ts +17 -0
- package/models/log.model.js +4 -0
- package/models/log.model.js.map +1 -0
- package/{src/models/logged-in-users.model.ts → models/logged-in-users.model.d.ts} +5 -6
- package/models/logged-in-users.model.js +4 -0
- package/models/logged-in-users.model.js.map +1 -0
- package/{src/models/method-response.model.ts → models/method-response.model.d.ts} +6 -7
- package/models/method-response.model.js +4 -0
- package/models/method-response.model.js.map +1 -0
- package/models/method.model.d.ts +26 -0
- package/models/method.model.js +4 -0
- package/models/method.model.js.map +1 -0
- package/{src/models/monitor-cpu.model.ts → models/monitor-cpu.model.d.ts} +7 -9
- package/models/monitor-cpu.model.js +4 -0
- package/models/monitor-cpu.model.js.map +1 -0
- package/models/monitor-function.model.d.ts +14 -0
- package/models/monitor-function.model.js +4 -0
- package/models/monitor-function.model.js.map +1 -0
- package/models/monitor-memory.model.d.ts +15 -0
- package/models/monitor-memory.model.js +4 -0
- package/models/monitor-memory.model.js.map +1 -0
- package/models/monitor-mongo.model.d.ts +13 -0
- package/models/monitor-mongo.model.js +4 -0
- package/models/monitor-mongo.model.js.map +1 -0
- package/{src/models/notification.model.ts → models/notification.model.d.ts} +4 -6
- package/models/notification.model.js +4 -0
- package/models/notification.model.js.map +1 -0
- package/models/openai-usage-ledger.model.d.ts +30 -0
- package/models/openai-usage-ledger.model.js +4 -0
- package/models/openai-usage-ledger.model.js.map +1 -0
- package/models/pagination.model.d.ts +11 -0
- package/models/pagination.model.js +28 -0
- package/models/pagination.model.js.map +1 -0
- package/models/permission.model.d.ts +12 -0
- package/models/permission.model.js +4 -0
- package/models/permission.model.js.map +1 -0
- package/models/report-builder-dashboard-builder.model.d.ts +25 -0
- package/models/report-builder-dashboard-builder.model.js +4 -0
- package/models/report-builder-dashboard-builder.model.js.map +1 -0
- package/models/report-builder-library.model.d.ts +17 -0
- package/models/report-builder-library.model.js +4 -0
- package/models/report-builder-library.model.js.map +1 -0
- package/models/report-builder-report.model.d.ts +121 -0
- package/models/report-builder-report.model.js +4 -0
- package/models/report-builder-report.model.js.map +1 -0
- package/models/report-builder.model.d.ts +61 -0
- package/models/report-builder.model.js +4 -0
- package/models/report-builder.model.js.map +1 -0
- package/models/select-data-label.model.d.ts +9 -0
- package/models/select-data-label.model.js +4 -0
- package/models/select-data-label.model.js.map +1 -0
- package/models/server-message.model.d.ts +32 -0
- package/models/server-message.model.js +4 -0
- package/models/server-message.model.js.map +1 -0
- package/models/slow-query-report.model.d.ts +23 -0
- package/models/slow-query-report.model.js +4 -0
- package/models/slow-query-report.model.js.map +1 -0
- package/models/subscription.model.d.ts +31 -0
- package/models/subscription.model.js +4 -0
- package/models/subscription.model.js.map +1 -0
- package/models/support-ticket.model.d.ts +87 -0
- package/models/support-ticket.model.js +4 -0
- package/models/support-ticket.model.js.map +1 -0
- package/models/user-group.model.d.ts +20 -0
- package/models/user-group.model.js +4 -0
- package/models/user-group.model.js.map +1 -0
- package/{src/models/user-guide.model.ts → models/user-guide.model.d.ts} +4 -5
- package/models/user-guide.model.js +4 -0
- package/models/user-guide.model.js.map +1 -0
- package/models/user.model.d.ts +84 -0
- package/models/user.model.js +4 -0
- package/models/user.model.js.map +1 -0
- package/package.json +1 -1
- package/private/images/ResolveIO.png +0 -0
- package/public_api.js +127 -0
- package/public_api.js.map +1 -0
- package/publications/ai-terminal.d.ts +1 -0
- package/publications/ai-terminal.js +122 -0
- package/publications/ai-terminal.js.map +1 -0
- package/publications/app-settings.d.ts +2 -0
- package/publications/app-settings.js +28 -0
- package/publications/app-settings.js.map +1 -0
- package/publications/app-status.d.ts +2 -0
- package/publications/app-status.js +16 -0
- package/publications/app-status.js.map +1 -0
- package/publications/cron-jobs.d.ts +2 -0
- package/publications/cron-jobs.js +88 -0
- package/publications/cron-jobs.js.map +1 -0
- package/publications/customer-notifications.d.ts +2 -0
- package/publications/customer-notifications.js +161 -0
- package/publications/customer-notifications.js.map +1 -0
- package/publications/files.d.ts +2 -0
- package/publications/files.js +36 -0
- package/publications/files.js.map +1 -0
- package/publications/flags-update.d.ts +2 -0
- package/publications/flags-update.js +22 -0
- package/publications/flags-update.js.map +1 -0
- package/publications/flags.d.ts +2 -0
- package/publications/flags.js +22 -0
- package/publications/flags.js.map +1 -0
- package/publications/logs.d.ts +2 -0
- package/publications/logs.js +164 -0
- package/publications/logs.js.map +1 -0
- package/publications/notifications.d.ts +2 -0
- package/publications/notifications.js +16 -0
- package/publications/notifications.js.map +1 -0
- package/publications/report-builder-dashboard-builders.d.ts +2 -0
- package/publications/report-builder-dashboard-builders.js +42 -0
- package/publications/report-builder-dashboard-builders.js.map +1 -0
- package/publications/report-builder-libraries.d.ts +2 -0
- package/publications/report-builder-libraries.js +90 -0
- package/publications/report-builder-libraries.js.map +1 -0
- package/publications/report-builder-reports.d.ts +2 -0
- package/publications/report-builder-reports.js +50 -0
- package/publications/report-builder-reports.js.map +1 -0
- package/publications/super-admin.d.ts +2 -0
- package/publications/super-admin.js +16 -0
- package/publications/super-admin.js.map +1 -0
- package/publications/user-groups.d.ts +1 -0
- package/publications/user-groups.js +16 -0
- package/publications/user-groups.js.map +1 -0
- package/publications/user-guides.d.ts +1 -0
- package/publications/user-guides.js +16 -0
- package/publications/user-guides.js.map +1 -0
- package/resolveio-server-app.d.ts +70 -0
- package/resolveio-server-app.js +801 -0
- package/resolveio-server-app.js.map +1 -0
- package/server-app.d.ts +228 -0
- package/server-app.js +3566 -0
- package/server-app.js.map +1 -0
- package/services/codex-client.d.ts +128 -0
- package/services/codex-client.js +1629 -0
- package/services/codex-client.js.map +1 -0
- package/services/openai-client.d.ts +46 -0
- package/services/openai-client.js +318 -0
- package/services/openai-client.js.map +1 -0
- package/types/error-report.d.ts +25 -0
- package/types/error-report.js +4 -0
- package/types/error-report.js.map +1 -0
- package/types/slow-query-report.d.ts +27 -0
- package/types/slow-query-report.js +6 -0
- package/types/slow-query-report.js.map +1 -0
- package/util/ai-qa-policy.d.ts +124 -0
- package/util/ai-qa-policy.js +736 -0
- package/util/ai-qa-policy.js.map +1 -0
- package/util/ai-run-evidence-adapters.d.ts +33 -0
- package/util/ai-run-evidence-adapters.js +838 -0
- package/util/ai-run-evidence-adapters.js.map +1 -0
- package/util/ai-run-evidence-dashboard.d.ts +84 -0
- package/util/ai-run-evidence-dashboard.js +336 -0
- package/util/ai-run-evidence-dashboard.js.map +1 -0
- package/util/ai-run-evidence-eval.d.ts +86 -0
- package/util/ai-run-evidence-eval.js +854 -0
- package/util/ai-run-evidence-eval.js.map +1 -0
- package/util/ai-run-evidence.d.ts +244 -0
- package/util/ai-run-evidence.js +731 -0
- package/util/ai-run-evidence.js.map +1 -0
- package/util/ai-runner-artifacts.d.ts +82 -0
- package/util/ai-runner-artifacts.js +713 -0
- package/util/ai-runner-artifacts.js.map +1 -0
- package/util/ai-runner-manager-autopilot.d.ts +112 -0
- package/util/ai-runner-manager-autopilot.js +313 -0
- package/util/ai-runner-manager-autopilot.js.map +1 -0
- package/util/ai-runner-manager-policy.d.ts +403 -0
- package/util/ai-runner-manager-policy.js +1763 -0
- package/util/ai-runner-manager-policy.js.map +1 -0
- package/util/ai-runner-qa-auth.d.ts +5 -0
- package/util/ai-runner-qa-auth.js +822 -0
- package/util/ai-runner-qa-auth.js.map +1 -0
- package/util/ai-runner-qa-tools.d.ts +26 -0
- package/util/ai-runner-qa-tools.js +3029 -0
- package/util/ai-runner-qa-tools.js.map +1 -0
- package/util/aicoder-runner-v6.d.ts +214 -0
- package/util/aicoder-runner-v6.js +507 -0
- package/util/aicoder-runner-v6.js.map +1 -0
- package/util/common.d.ts +31 -0
- package/util/common.js +683 -0
- package/util/common.js.map +1 -0
- package/util/customer-portal-password.d.ts +13 -0
- package/util/customer-portal-password.js +209 -0
- package/util/customer-portal-password.js.map +1 -0
- package/util/error-reporter.d.ts +52 -0
- package/util/error-reporter.js +326 -0
- package/util/error-reporter.js.map +1 -0
- package/util/error-tracking.d.ts +13 -0
- package/util/error-tracking.js +120 -0
- package/util/error-tracking.js.map +1 -0
- package/util/openai-usage-cost.d.ts +6 -0
- package/util/openai-usage-cost.js +103 -0
- package/util/openai-usage-cost.js.map +1 -0
- package/util/report-builder-unwinds.d.ts +15 -0
- package/util/report-builder-unwinds.js +156 -0
- package/util/report-builder-unwinds.js.map +1 -0
- package/util/runner-process-janitor.d.ts +27 -0
- package/util/runner-process-janitor.js +208 -0
- package/util/runner-process-janitor.js.map +1 -0
- package/util/schema-report-builder.d.ts +6 -0
- package/util/schema-report-builder.js +481 -0
- package/util/schema-report-builder.js.map +1 -0
- package/util/slow-query-reporter.d.ts +28 -0
- package/util/slow-query-reporter.js +226 -0
- package/util/slow-query-reporter.js.map +1 -0
- package/util/subscription-dependency-context.d.ts +34 -0
- package/util/subscription-dependency-context.js +1283 -0
- package/util/subscription-dependency-context.js.map +1 -0
- package/util/support-runner-v5.d.ts +425 -0
- package/util/support-runner-v5.js +1517 -0
- package/util/support-runner-v5.js.map +1 -0
- package/util/tokenizer.d.ts +5 -0
- package/util/tokenizer.js +41 -0
- package/util/tokenizer.js.map +1 -0
- package/workers/codex-runner.worker.d.ts +1 -0
- package/workers/codex-runner.worker.js +192 -0
- package/workers/codex-runner.worker.js.map +1 -0
- package/.nodemon.json +0 -5
- package/.vscode/settings.json +0 -21
- package/AGENTS.md +0 -195
- package/README.md +0 -22
- package/build_package.sh +0 -5
- package/compileDTS.pl +0 -64
- package/docs/ai-assistant-nightly-eval.md +0 -65
- package/docs/ai-assistant-preflight-checklist.md +0 -23
- package/docs/ai-assistant-report-builder-bridge-playbook.md +0 -115
- package/eslint-plugin-custom/index.js +0 -7
- package/eslint-plugin-custom/rules/no-filter-zero-index.js +0 -44
- package/eslint.config.js +0 -103
- package/gulpfile.js +0 -216
- package/methodAndPublicationListGenerator.py +0 -375
- package/mongodbensurers.js +0 -2
- package/mongostop.js +0 -3
- package/scripts/cleanup-bypassed-callmethod-logs.js +0 -616
- package/settings.development.json +0 -25
- package/settings.development.redacted.json +0 -25
- package/src/.env +0 -12
- package/src/ai/assistant-core-heuristics.ts +0 -379
- package/src/ai/resolveio-platform-intelligence-memory-corpus.ts +0 -185
- package/src/ai/resolveio-platform-intelligence-memory.ts +0 -325
- package/src/ai/resolveio-platform-intelligence.ts +0 -462
- package/src/client-server-app.ts +0 -12
- package/src/collections/ai-run.collection.ts +0 -117
- package/src/collections/ai-terminal-conversation.collection.ts +0 -91
- package/src/collections/ai-terminal-issue-report.collection.ts +0 -99
- package/src/collections/ai-terminal-message.collection.ts +0 -77
- package/src/collections/app-setting.collection.ts +0 -104
- package/src/collections/app-status.collection.ts +0 -58
- package/src/collections/communication-metric.collection.ts +0 -84
- package/src/collections/counter.collection.ts +0 -56
- package/src/collections/cron-job-history.collection.ts +0 -94
- package/src/collections/cron-job.collection.ts +0 -92
- package/src/collections/customer-notification.collection.ts +0 -131
- package/src/collections/customer-portal-password.collection.ts +0 -76
- package/src/collections/email-history.collection.ts +0 -134
- package/src/collections/email-verified.collection.ts +0 -62
- package/src/collections/file.collection.ts +0 -74
- package/src/collections/flag-update.collection.ts +0 -57
- package/src/collections/flag.collection.ts +0 -57
- package/src/collections/log-method-latency.collection.ts +0 -77
- package/src/collections/log-subscription.collection.ts +0 -80
- package/src/collections/log.collection.ts +0 -93
- package/src/collections/logged-in-users.collection.ts +0 -67
- package/src/collections/monitor-cpu.collection.ts +0 -65
- package/src/collections/monitor-function.collection.ts +0 -74
- package/src/collections/monitor-memory.collection.ts +0 -77
- package/src/collections/monitor-mongo.collection.ts +0 -71
- package/src/collections/notification.collection.ts +0 -57
- package/src/collections/openai-usage-ledger.collection.ts +0 -131
- package/src/collections/report-builder-dashboard-builder.collection.ts +0 -109
- package/src/collections/report-builder-library.collection.ts +0 -89
- package/src/collections/report-builder-report.collection.ts +0 -184
- package/src/collections/user-group.collection.ts +0 -89
- package/src/collections/user-guide.collection.ts +0 -57
- package/src/collections/user.collection.ts +0 -181
- package/src/cron/cron.ts +0 -117
- package/src/fixtures/cron-jobs.ts +0 -95
- package/src/fixtures/init.ts +0 -35
- package/src/http/auth.ts +0 -818
- package/src/http/health.ts +0 -7
- package/src/http/home.ts +0 -90
- package/src/http/slow-query-publication.ts +0 -49
- package/src/index.ts +0 -1
- package/src/managers/ai-assistant-codex-manager.manager.ts +0 -1131
- package/src/managers/ai-run-evidence.manager.ts +0 -264
- package/src/managers/communication-metric.manager.ts +0 -82
- package/src/managers/cron.manager.ts +0 -333
- package/src/managers/customer-notification-content.manager.ts +0 -236
- package/src/managers/diagnostic-manager-bootstrap.ts +0 -165
- package/src/managers/error-auto-fix.manager.ts +0 -2767
- package/src/managers/local-log.manager.ts +0 -113
- package/src/managers/method.manager.ts +0 -1857
- package/src/managers/mongo.manager.ts +0 -4575
- package/src/managers/monitor.manager.ts +0 -507
- package/src/managers/openai-usage-ledger.manager.ts +0 -112
- package/src/managers/slow-query-verifier.manager.ts +0 -3590
- package/src/managers/slow-query.manager.ts +0 -519
- package/src/managers/subscription.manager.ts +0 -3128
- package/src/managers/websocket.manager.ts +0 -746
- package/src/managers/worker-dispatcher.manager.ts +0 -1360
- package/src/managers/worker-server.manager.ts +0 -536
- package/src/methods/accounts.ts +0 -532
- package/src/methods/ai-terminal.ts +0 -23524
- package/src/methods/app-settings.ts +0 -114
- package/src/methods/aws.ts +0 -649
- package/src/methods/collections.ts +0 -641
- package/src/methods/counters.ts +0 -69
- package/src/methods/cron-jobs.ts +0 -2614
- package/src/methods/customer-notifications.ts +0 -458
- package/src/methods/diagnostics.ts +0 -616
- package/src/methods/flag-updates.ts +0 -7
- package/src/methods/flags.ts +0 -7
- package/src/methods/logs.ts +0 -657
- package/src/methods/mongo-explorer.ts +0 -1880
- package/src/methods/monitor.ts +0 -540
- package/src/methods/pdf.ts +0 -1236
- package/src/methods/publications.ts +0 -129
- package/src/methods/report-builder.ts +0 -3300
- package/src/methods/support.ts +0 -335
- package/src/models/ai-run.model.ts +0 -27
- package/src/models/ai-terminal-conversation.model.ts +0 -19
- package/src/models/ai-terminal-issue-report.model.ts +0 -21
- package/src/models/ai-terminal-message.model.ts +0 -24
- package/src/models/app-setting.model.ts +0 -17
- package/src/models/collection-document.model.ts +0 -24
- package/src/models/communication-metric.model.ts +0 -23
- package/src/models/cron-job-history.model.ts +0 -16
- package/src/models/cron-job.model.ts +0 -15
- package/src/models/customer-notification.model.ts +0 -28
- package/src/models/customer-portal-password.model.ts +0 -12
- package/src/models/dialog.model.ts +0 -25
- package/src/models/log-method-latency.model.ts +0 -11
- package/src/models/log.model.ts +0 -19
- package/src/models/method.model.ts +0 -25
- package/src/models/monitor-function.model.ts +0 -16
- package/src/models/monitor-memory.model.ts +0 -17
- package/src/models/monitor-mongo.model.ts +0 -15
- package/src/models/openai-usage-ledger.model.ts +0 -56
- package/src/models/pagination.model.ts +0 -35
- package/src/models/permission.model.ts +0 -14
- package/src/models/report-builder-dashboard-builder.model.ts +0 -29
- package/src/models/report-builder-library.model.ts +0 -20
- package/src/models/report-builder-report.model.ts +0 -136
- package/src/models/report-builder.model.ts +0 -68
- package/src/models/select-data-label.model.ts +0 -9
- package/src/models/server-message.model.ts +0 -31
- package/src/models/slow-query-report.model.ts +0 -23
- package/src/models/subscription.model.ts +0 -73
- package/src/models/support-ticket.model.ts +0 -104
- package/src/models/user-group.model.ts +0 -24
- package/src/models/user.model.ts +0 -96
- package/src/private/images/ResolveIO.png +0 -0
- package/src/publications/ai-terminal.ts +0 -73
- package/src/publications/app-settings.ts +0 -25
- package/src/publications/app-status.ts +0 -13
- package/src/publications/cron-jobs.ts +0 -40
- package/src/publications/customer-notifications.ts +0 -101
- package/src/publications/files.ts +0 -33
- package/src/publications/flags-update.ts +0 -19
- package/src/publications/flags.ts +0 -19
- package/src/publications/logs.ts +0 -163
- package/src/publications/notifications.ts +0 -13
- package/src/publications/report-builder-dashboard-builders.ts +0 -39
- package/src/publications/report-builder-libraries.ts +0 -41
- package/src/publications/report-builder-reports.ts +0 -47
- package/src/publications/super-admin.ts +0 -13
- package/src/publications/user-groups.ts +0 -12
- package/src/publications/user-guides.ts +0 -12
- package/src/resolveio-server-app.ts +0 -617
- package/src/server-app.ts +0 -3354
- package/src/services/codex-client.ts +0 -1231
- package/src/services/openai-client.ts +0 -265
- package/src/types/error-report.ts +0 -26
- package/src/types/js-tiktoken.d.ts +0 -11
- package/src/types/slow-query-report.ts +0 -28
- package/src/util/ai-qa-policy.ts +0 -925
- package/src/util/ai-run-evidence-adapters.ts +0 -684
- package/src/util/ai-run-evidence-dashboard.ts +0 -313
- package/src/util/ai-run-evidence-eval.ts +0 -885
- package/src/util/ai-run-evidence.ts +0 -1058
- package/src/util/ai-runner-artifacts.ts +0 -586
- package/src/util/ai-runner-manager-autopilot.ts +0 -434
- package/src/util/ai-runner-manager-policy.ts +0 -2733
- package/src/util/ai-runner-qa-auth.ts +0 -821
- package/src/util/ai-runner-qa-tools.ts +0 -3045
- package/src/util/aicoder-runner-v6.ts +0 -875
- package/src/util/common.ts +0 -649
- package/src/util/customer-portal-password.ts +0 -183
- package/src/util/error-reporter.ts +0 -332
- package/src/util/error-tracking.ts +0 -79
- package/src/util/openai-usage-cost.ts +0 -114
- package/src/util/report-builder-unwinds.ts +0 -180
- package/src/util/runner-process-janitor.ts +0 -219
- package/src/util/schema-report-builder.ts +0 -448
- package/src/util/slow-query-reporter.ts +0 -216
- package/src/util/subscription-dependency-context.ts +0 -1096
- package/src/util/support-runner-v5.ts +0 -2167
- package/src/util/tokenizer.ts +0 -38
- package/src/workers/codex-runner.worker.ts +0 -142
- package/start_server.sh +0 -5
- package/tests/ai-assistant-corpus-build.ts +0 -484
- package/tests/ai-assistant-corpus-replay-e2e.ts +0 -774
- package/tests/ai-assistant-data-parity-e2e.ts +0 -1989
- package/tests/ai-assistant-eval-triage.ts +0 -831
- package/tests/ai-assistant-openai-e2e.ts +0 -1061
- package/tests/ai-assistant-openai-git-e2e.ts +0 -155
- package/tests/ai-assistant-preflight-matrix.ts +0 -215
- package/tests/ai-assistant-routing-eval.test.ts +0 -560
- package/tests/ai-assistant-snf-live-eval.ts +0 -975
- package/tests/ai-assistant-utils.test.ts +0 -2968
- package/tests/ai-manager-autopilot-snapshot.test.ts +0 -177
- package/tests/ai-manager-recovery-checkpoint.test.ts +0 -595
- package/tests/ai-run-eval.test.ts +0 -88
- package/tests/ai-run-evidence.test.ts +0 -348
- package/tests/ai-runner-contract.test.ts +0 -488
- package/tests/aicoder-runner-v6.test.ts +0 -298
- package/tests/error-reporter.test.ts +0 -145
- package/tests/method-publication-generator.test.ts +0 -46
- package/tests/report-builder-linking.test.ts +0 -79
- package/tests/resolveio-platform-intelligence.test.ts +0 -352
- package/tests/server-app-cron-owner.test.ts +0 -127
- package/tests/subscription-connect-race.test.ts +0 -158
- package/tests/subscription-dependency-context.test.ts +0 -324
- package/tests/subscription-manager-collection-tracking.test.ts +0 -86
- package/tests/subscription-manager-invalidation.test.ts +0 -86
- package/tests/support-runner-v5.test.ts +0 -488
- package/tsconfig.json +0 -34
- /package/{src/private → private}/email-templates/enrollment.html +0 -0
- /package/{src/private → private}/email-templates/forgot-password.html +0 -0
- /package/{src/private → private}/email-templates/support-ticket-deleted.html +0 -0
- /package/{src/private → private}/email-templates/support-ticket-modified.html +0 -0
- /package/{src/private → private}/email-templates/support-ticket.html +0 -0
- /package/{src/public_api.ts → public_api.d.ts} +0 -0
|
@@ -1,1058 +0,0 @@
|
|
|
1
|
-
export type AIRunSource =
|
|
2
|
-
| 'support_ticket'
|
|
3
|
-
| 'aicoder_app'
|
|
4
|
-
| 'ai_assistant'
|
|
5
|
-
| 'qa_runner'
|
|
6
|
-
| 'unknown';
|
|
7
|
-
|
|
8
|
-
export type AIRunOutcomeLabel =
|
|
9
|
-
| 'accepted'
|
|
10
|
-
| 'rejected'
|
|
11
|
-
| 'qa_incomplete'
|
|
12
|
-
| 'qa_infra_failed'
|
|
13
|
-
| 'build_failed'
|
|
14
|
-
| 'release_blocked'
|
|
15
|
-
| 'manual_handoff'
|
|
16
|
-
| 'false_pass'
|
|
17
|
-
| 'stopped'
|
|
18
|
-
| 'unknown';
|
|
19
|
-
|
|
20
|
-
export type AIRunEventType =
|
|
21
|
-
| 'model_call'
|
|
22
|
-
| 'log'
|
|
23
|
-
| 'qa_infra'
|
|
24
|
-
| 'qa_compile'
|
|
25
|
-
| 'qa_route_probe'
|
|
26
|
-
| 'qa_business_assertion'
|
|
27
|
-
| 'scorecard'
|
|
28
|
-
| 'deploy'
|
|
29
|
-
| 'publish'
|
|
30
|
-
| 'assistant_message'
|
|
31
|
-
| 'git_commit'
|
|
32
|
-
| 'usage'
|
|
33
|
-
| 'human_intervention';
|
|
34
|
-
|
|
35
|
-
export type AIRunGateStatus = 'pass' | 'fail' | 'warn' | 'blocked' | 'skipped';
|
|
36
|
-
|
|
37
|
-
export type AIQaCheckStatus = 'pass' | 'fail' | 'blocked' | 'warn' | 'skipped' | 'unknown';
|
|
38
|
-
|
|
39
|
-
export type AIQaCompileStatus = 'pass' | 'fail' | 'blocked' | 'stale' | 'skipped' | 'unknown';
|
|
40
|
-
|
|
41
|
-
export type AIQaOutcome =
|
|
42
|
-
| 'infra_failed'
|
|
43
|
-
| 'compile_failed'
|
|
44
|
-
| 'route_failed'
|
|
45
|
-
| 'route_only_pass'
|
|
46
|
-
| 'business_assertion_passed'
|
|
47
|
-
| 'business_assertion_failed'
|
|
48
|
-
| 'incomplete';
|
|
49
|
-
|
|
50
|
-
export interface AIRunEvent {
|
|
51
|
-
id?: string;
|
|
52
|
-
type: AIRunEventType;
|
|
53
|
-
source?: AIRunSource | string;
|
|
54
|
-
message?: string;
|
|
55
|
-
category?: string;
|
|
56
|
-
artifactPaths?: string[];
|
|
57
|
-
metadata?: Record<string, any>;
|
|
58
|
-
recordedAt?: Date | string;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export interface AIRunGateResult {
|
|
62
|
-
key: string;
|
|
63
|
-
label: string;
|
|
64
|
-
status: AIRunGateStatus;
|
|
65
|
-
reason: string;
|
|
66
|
-
evidenceRefs: string[];
|
|
67
|
-
recordedAt: string;
|
|
68
|
-
metadata?: Record<string, any>;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export interface AIRunCost {
|
|
72
|
-
inputTokens: number;
|
|
73
|
-
cachedInputTokens: number;
|
|
74
|
-
outputTokens: number;
|
|
75
|
-
totalTokens: number;
|
|
76
|
-
estimatedUsd: number;
|
|
77
|
-
models: string[];
|
|
78
|
-
categories: Record<string, {
|
|
79
|
-
inputTokens: number;
|
|
80
|
-
cachedInputTokens: number;
|
|
81
|
-
outputTokens: number;
|
|
82
|
-
totalTokens: number;
|
|
83
|
-
estimatedUsd: number;
|
|
84
|
-
count: number;
|
|
85
|
-
}>;
|
|
86
|
-
sources?: Record<string, {
|
|
87
|
-
inputTokens: number;
|
|
88
|
-
cachedInputTokens: number;
|
|
89
|
-
outputTokens: number;
|
|
90
|
-
totalTokens: number;
|
|
91
|
-
estimatedUsd: number;
|
|
92
|
-
count: number;
|
|
93
|
-
manualCount: number;
|
|
94
|
-
untrackedCount: number;
|
|
95
|
-
}>;
|
|
96
|
-
surfaces?: Record<string, {
|
|
97
|
-
totalTokens: number;
|
|
98
|
-
estimatedUsd: number;
|
|
99
|
-
count: number;
|
|
100
|
-
}>;
|
|
101
|
-
manualEstimatedUsd?: number;
|
|
102
|
-
untrackedEstimatedUsd?: number;
|
|
103
|
-
untrackedWarnings?: string[];
|
|
104
|
-
wallTimeMs?: number;
|
|
105
|
-
retries?: number;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export interface OpenAIUsageCostEntry {
|
|
109
|
-
model?: string;
|
|
110
|
-
category?: string;
|
|
111
|
-
id_request?: string;
|
|
112
|
-
idRequest?: string;
|
|
113
|
-
id_conversation?: string;
|
|
114
|
-
idConversation?: string;
|
|
115
|
-
timestamp?: Date | string;
|
|
116
|
-
input_tokens?: number;
|
|
117
|
-
inputTokens?: number;
|
|
118
|
-
cached_input_tokens?: number;
|
|
119
|
-
cachedInputTokens?: number;
|
|
120
|
-
output_tokens?: number;
|
|
121
|
-
outputTokens?: number;
|
|
122
|
-
total_tokens?: number;
|
|
123
|
-
totalTokens?: number;
|
|
124
|
-
cost_estimate?: number;
|
|
125
|
-
estimatedUsd?: number;
|
|
126
|
-
usage_source?: string;
|
|
127
|
-
usageSource?: string;
|
|
128
|
-
usage_surface?: string;
|
|
129
|
-
usageSurface?: string;
|
|
130
|
-
usage_phase?: string;
|
|
131
|
-
usagePhase?: string;
|
|
132
|
-
cost_basis?: string;
|
|
133
|
-
costBasis?: string;
|
|
134
|
-
is_manual?: boolean;
|
|
135
|
-
isManual?: boolean;
|
|
136
|
-
is_untracked?: boolean;
|
|
137
|
-
isUntracked?: boolean;
|
|
138
|
-
untracked_reason?: string;
|
|
139
|
-
untrackedReason?: string;
|
|
140
|
-
[key: string]: any;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
export interface AIQaInfraCheck {
|
|
144
|
-
name: string;
|
|
145
|
-
status: AIQaCheckStatus;
|
|
146
|
-
message?: string;
|
|
147
|
-
path?: string;
|
|
148
|
-
durationMs?: number;
|
|
149
|
-
metadata?: Record<string, any>;
|
|
150
|
-
checkedAt?: Date | string;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
export interface AIQaCompileResult {
|
|
154
|
-
status: AIQaCompileStatus;
|
|
155
|
-
command?: string;
|
|
156
|
-
artifactPath?: string;
|
|
157
|
-
message?: string;
|
|
158
|
-
durationMs?: number;
|
|
159
|
-
staleEvidence?: boolean;
|
|
160
|
-
recordedAt?: Date | string;
|
|
161
|
-
metadata?: Record<string, any>;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
export interface AIQaRouteProbe {
|
|
165
|
-
route: string;
|
|
166
|
-
status: AIQaCheckStatus;
|
|
167
|
-
screenshot?: string;
|
|
168
|
-
caption?: string;
|
|
169
|
-
shellOnly?: boolean;
|
|
170
|
-
authenticated?: boolean;
|
|
171
|
-
consoleErrors?: string[];
|
|
172
|
-
networkErrors?: string[];
|
|
173
|
-
message?: string;
|
|
174
|
-
recordedAt?: Date | string;
|
|
175
|
-
metadata?: Record<string, any>;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
export interface AIQaBusinessAssertion {
|
|
179
|
-
assertion: string;
|
|
180
|
-
status: AIQaCheckStatus;
|
|
181
|
-
workflow?: string;
|
|
182
|
-
route?: string;
|
|
183
|
-
action?: string;
|
|
184
|
-
expected?: string;
|
|
185
|
-
observed?: string;
|
|
186
|
-
dataProof?: string;
|
|
187
|
-
mongoDelta?: Record<string, any>;
|
|
188
|
-
artifactPaths?: string[];
|
|
189
|
-
message?: string;
|
|
190
|
-
recordedAt?: Date | string;
|
|
191
|
-
metadata?: Record<string, any>;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
export interface AIQaArtifact {
|
|
195
|
-
type: 'screenshot' | 'trace' | 'console_log' | 'network_log' | 'coverage_matrix' | 'seed_data' | 'script' | 'other';
|
|
196
|
-
path?: string;
|
|
197
|
-
url?: string;
|
|
198
|
-
title?: string;
|
|
199
|
-
caption?: string;
|
|
200
|
-
metadata?: Record<string, any>;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
export interface AIQaRun {
|
|
204
|
-
outcome: AIQaOutcome;
|
|
205
|
-
infraChecks: AIQaInfraCheck[];
|
|
206
|
-
compile?: AIQaCompileResult;
|
|
207
|
-
routeProbes: AIQaRouteProbe[];
|
|
208
|
-
businessAssertions: AIQaBusinessAssertion[];
|
|
209
|
-
artifacts: AIQaArtifact[];
|
|
210
|
-
gateResults: AIRunGateResult[];
|
|
211
|
-
updatedAt: string;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
export interface AIRun {
|
|
215
|
-
id?: string;
|
|
216
|
-
source: AIRunSource;
|
|
217
|
-
sourceIds: Record<string, string>;
|
|
218
|
-
title?: string;
|
|
219
|
-
status?: string;
|
|
220
|
-
phase?: string;
|
|
221
|
-
startedAt?: Date | string;
|
|
222
|
-
completedAt?: Date | string;
|
|
223
|
-
outcome: AIRunOutcomeLabel;
|
|
224
|
-
events: AIRunEvent[];
|
|
225
|
-
gates: AIRunGateResult[];
|
|
226
|
-
qa?: AIQaRun;
|
|
227
|
-
cost?: AIRunCost;
|
|
228
|
-
nextAction?: string;
|
|
229
|
-
warnings?: string[];
|
|
230
|
-
metadata?: Record<string, any>;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
export interface AIRunTrainingExample {
|
|
234
|
-
runId: string;
|
|
235
|
-
source: AIRunSource;
|
|
236
|
-
inputSummary: string;
|
|
237
|
-
actionSummary: string;
|
|
238
|
-
outcome: AIRunOutcomeLabel;
|
|
239
|
-
evidence: string[];
|
|
240
|
-
cost?: AIRunCost;
|
|
241
|
-
metadata?: Record<string, any>;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
export interface AIQaEvaluationInput {
|
|
245
|
-
infraChecks?: AIQaInfraCheck[];
|
|
246
|
-
compile?: AIQaCompileResult;
|
|
247
|
-
routeProbes?: AIQaRouteProbe[];
|
|
248
|
-
businessAssertions?: AIQaBusinessAssertion[];
|
|
249
|
-
artifacts?: AIQaArtifact[];
|
|
250
|
-
now?: Date | string;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
export interface AIRunOutcomeInput {
|
|
254
|
-
source?: AIRunSource;
|
|
255
|
-
status?: string;
|
|
256
|
-
phase?: string;
|
|
257
|
-
qa?: AIQaRun | AIQaEvaluationInput;
|
|
258
|
-
gates?: AIRunGateResult[];
|
|
259
|
-
scorecardPassed?: boolean;
|
|
260
|
-
scorecardStatus?: string;
|
|
261
|
-
deployStatus?: string;
|
|
262
|
-
publishStatus?: string;
|
|
263
|
-
sampleDataStatus?: string;
|
|
264
|
-
manualHandoff?: boolean;
|
|
265
|
-
stopped?: boolean;
|
|
266
|
-
rejected?: boolean;
|
|
267
|
-
explicitAccepted?: boolean;
|
|
268
|
-
terminal?: boolean;
|
|
269
|
-
now?: Date | string;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
export interface AIRunOutcomeDecision {
|
|
273
|
-
outcome: AIRunOutcomeLabel;
|
|
274
|
-
reason: string;
|
|
275
|
-
nextAction: string;
|
|
276
|
-
gates: AIRunGateResult[];
|
|
277
|
-
warnings: string[];
|
|
278
|
-
recordedAt: string;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
function isoNow(value?: Date | string): string {
|
|
282
|
-
if (value instanceof Date) {
|
|
283
|
-
return value.toISOString();
|
|
284
|
-
}
|
|
285
|
-
const parsed = value ? new Date(value) : new Date();
|
|
286
|
-
if (Number.isFinite(parsed.getTime())) {
|
|
287
|
-
return parsed.toISOString();
|
|
288
|
-
}
|
|
289
|
-
return new Date().toISOString();
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
function cleanText(value: any, max = 1000): string {
|
|
293
|
-
return String(value || '').replace(/\s+/g, ' ').trim().slice(0, max);
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
function cleanUsageNumber(value: any): number {
|
|
297
|
-
const parsed = Number(value);
|
|
298
|
-
return Number.isFinite(parsed) ? parsed : 0;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
function cleanUsageDate(value: any): Date | undefined {
|
|
302
|
-
if (!value) {
|
|
303
|
-
return undefined;
|
|
304
|
-
}
|
|
305
|
-
const date = value instanceof Date ? value : new Date(value);
|
|
306
|
-
return Number.isFinite(date.getTime()) ? date : undefined;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
export function isCumulativeCodexUsageEntry(entry: OpenAIUsageCostEntry): boolean {
|
|
310
|
-
return cleanText(entry?.category, 180).toLowerCase().startsWith('ai-dashboard-codex:');
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
export function resolveOpenAIUsageThreadKey(entry: OpenAIUsageCostEntry): string {
|
|
314
|
-
const conversationId = cleanText(entry?.id_conversation ?? entry?.idConversation, 240);
|
|
315
|
-
if (conversationId) {
|
|
316
|
-
return conversationId;
|
|
317
|
-
}
|
|
318
|
-
return cleanText(entry?.id_request ?? entry?.idRequest, 240);
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
export function normalizeOpenAIUsageRowsForCosting<T extends OpenAIUsageCostEntry>(rows: T[] = []): T[] {
|
|
322
|
-
if (!Array.isArray(rows) || !rows.length) {
|
|
323
|
-
return [];
|
|
324
|
-
}
|
|
325
|
-
const sortedRows = rows
|
|
326
|
-
.map((row, index) => ({
|
|
327
|
-
...row,
|
|
328
|
-
_sortIndex: index
|
|
329
|
-
}))
|
|
330
|
-
.sort((a, b) => {
|
|
331
|
-
const timeA = cleanUsageDate(a.timestamp)?.getTime() || 0;
|
|
332
|
-
const timeB = cleanUsageDate(b.timestamp)?.getTime() || 0;
|
|
333
|
-
if (timeA !== timeB) {
|
|
334
|
-
return timeA - timeB;
|
|
335
|
-
}
|
|
336
|
-
const requestCompare = cleanText(a.id_request ?? a.idRequest, 240)
|
|
337
|
-
.localeCompare(cleanText(b.id_request ?? b.idRequest, 240));
|
|
338
|
-
if (requestCompare) {
|
|
339
|
-
return requestCompare;
|
|
340
|
-
}
|
|
341
|
-
const conversationCompare = cleanText(a.id_conversation ?? a.idConversation, 240)
|
|
342
|
-
.localeCompare(cleanText(b.id_conversation ?? b.idConversation, 240));
|
|
343
|
-
if (conversationCompare) {
|
|
344
|
-
return conversationCompare;
|
|
345
|
-
}
|
|
346
|
-
return cleanUsageNumber(a._sortIndex) - cleanUsageNumber(b._sortIndex);
|
|
347
|
-
});
|
|
348
|
-
const previousByThread = new Map<string, {
|
|
349
|
-
inputTokens: number;
|
|
350
|
-
cachedInputTokens: number;
|
|
351
|
-
outputTokens: number;
|
|
352
|
-
totalTokens: number;
|
|
353
|
-
estimatedUsd: number;
|
|
354
|
-
}>();
|
|
355
|
-
return sortedRows.map((row) => {
|
|
356
|
-
const inputTokens = cleanUsageNumber(row.input_tokens ?? row.inputTokens);
|
|
357
|
-
const cachedInputTokens = cleanUsageNumber(row.cached_input_tokens ?? row.cachedInputTokens);
|
|
358
|
-
const outputTokens = cleanUsageNumber(row.output_tokens ?? row.outputTokens);
|
|
359
|
-
const totalTokens = cleanUsageNumber(row.total_tokens ?? row.totalTokens ?? (inputTokens + outputTokens));
|
|
360
|
-
const estimatedUsd = cleanUsageNumber(row.cost_estimate ?? row.estimatedUsd);
|
|
361
|
-
const threadKey = isCumulativeCodexUsageEntry(row) ? resolveOpenAIUsageThreadKey(row) : '';
|
|
362
|
-
let normalizedInputTokens = inputTokens;
|
|
363
|
-
let normalizedCachedInputTokens = cachedInputTokens;
|
|
364
|
-
let normalizedOutputTokens = outputTokens;
|
|
365
|
-
let normalizedTotalTokens = totalTokens;
|
|
366
|
-
let normalizedEstimatedUsd = estimatedUsd;
|
|
367
|
-
if (threadKey) {
|
|
368
|
-
const previous = previousByThread.get(threadKey);
|
|
369
|
-
if (previous
|
|
370
|
-
&& inputTokens >= previous.inputTokens
|
|
371
|
-
&& cachedInputTokens >= previous.cachedInputTokens
|
|
372
|
-
&& outputTokens >= previous.outputTokens
|
|
373
|
-
&& totalTokens >= previous.totalTokens
|
|
374
|
-
&& estimatedUsd >= previous.estimatedUsd
|
|
375
|
-
) {
|
|
376
|
-
normalizedInputTokens = Math.max(0, inputTokens - previous.inputTokens);
|
|
377
|
-
normalizedCachedInputTokens = Math.max(0, cachedInputTokens - previous.cachedInputTokens);
|
|
378
|
-
normalizedOutputTokens = Math.max(0, outputTokens - previous.outputTokens);
|
|
379
|
-
normalizedTotalTokens = Math.max(0, totalTokens - previous.totalTokens);
|
|
380
|
-
normalizedEstimatedUsd = Math.max(0, estimatedUsd - previous.estimatedUsd);
|
|
381
|
-
}
|
|
382
|
-
previousByThread.set(threadKey, {
|
|
383
|
-
inputTokens,
|
|
384
|
-
cachedInputTokens,
|
|
385
|
-
outputTokens,
|
|
386
|
-
totalTokens,
|
|
387
|
-
estimatedUsd
|
|
388
|
-
});
|
|
389
|
-
}
|
|
390
|
-
const resolvedTotalTokens = normalizedTotalTokens || (normalizedInputTokens + normalizedOutputTokens);
|
|
391
|
-
const resolvedEstimatedUsd = Number(normalizedEstimatedUsd.toFixed(6));
|
|
392
|
-
return {
|
|
393
|
-
...row,
|
|
394
|
-
input_tokens: normalizedInputTokens,
|
|
395
|
-
inputTokens: normalizedInputTokens,
|
|
396
|
-
cached_input_tokens: normalizedCachedInputTokens,
|
|
397
|
-
cachedInputTokens: normalizedCachedInputTokens,
|
|
398
|
-
output_tokens: normalizedOutputTokens,
|
|
399
|
-
outputTokens: normalizedOutputTokens,
|
|
400
|
-
total_tokens: resolvedTotalTokens,
|
|
401
|
-
totalTokens: resolvedTotalTokens,
|
|
402
|
-
cost_estimate: resolvedEstimatedUsd,
|
|
403
|
-
estimatedUsd: resolvedEstimatedUsd
|
|
404
|
-
} as T;
|
|
405
|
-
});
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
function cleanList(values: any, limit = 20, max = 500): string[] {
|
|
409
|
-
if (!Array.isArray(values)) {
|
|
410
|
-
return [];
|
|
411
|
-
}
|
|
412
|
-
const result: string[] = [];
|
|
413
|
-
for (const value of values) {
|
|
414
|
-
const normalized = cleanText(value, max);
|
|
415
|
-
if (normalized && !result.includes(normalized)) {
|
|
416
|
-
result.push(normalized);
|
|
417
|
-
}
|
|
418
|
-
if (result.length >= limit) {
|
|
419
|
-
break;
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
return result;
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
function normalizeCheckStatus(value: any): AIQaCheckStatus {
|
|
426
|
-
const normalized = cleanText(value, 40).toLowerCase().replace(/[_\s-]+/g, '_');
|
|
427
|
-
if (normalized === 'passed' || normalized === 'ok' || normalized === 'ready') {
|
|
428
|
-
return 'pass';
|
|
429
|
-
}
|
|
430
|
-
if (normalized === 'failed' || normalized === 'error' || normalized === 'fail') {
|
|
431
|
-
return 'fail';
|
|
432
|
-
}
|
|
433
|
-
if (normalized === 'blocked' || normalized === 'dependency_blocked') {
|
|
434
|
-
return 'blocked';
|
|
435
|
-
}
|
|
436
|
-
if (normalized === 'warning') {
|
|
437
|
-
return 'warn';
|
|
438
|
-
}
|
|
439
|
-
if (normalized === 'skipped' || normalized === 'not_applicable') {
|
|
440
|
-
return 'skipped';
|
|
441
|
-
}
|
|
442
|
-
return normalized === 'pass' || normalized === 'warn' ? normalized : 'unknown';
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
function normalizeCompileStatus(value: any): AIQaCompileStatus {
|
|
446
|
-
const normalized = cleanText(value, 40).toLowerCase().replace(/[_\s-]+/g, '_');
|
|
447
|
-
if (normalized === 'passed' || normalized === 'ok') {
|
|
448
|
-
return 'pass';
|
|
449
|
-
}
|
|
450
|
-
if (normalized === 'failed' || normalized === 'error') {
|
|
451
|
-
return 'fail';
|
|
452
|
-
}
|
|
453
|
-
if (normalized === 'blocked') {
|
|
454
|
-
return 'blocked';
|
|
455
|
-
}
|
|
456
|
-
if (normalized === 'stale' || normalized === 'stale_evidence') {
|
|
457
|
-
return 'stale';
|
|
458
|
-
}
|
|
459
|
-
if (normalized === 'skipped' || normalized === 'not_applicable') {
|
|
460
|
-
return 'skipped';
|
|
461
|
-
}
|
|
462
|
-
return normalized === 'pass' || normalized === 'fail' ? normalized : 'unknown';
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
function makeGate(
|
|
466
|
-
key: string,
|
|
467
|
-
label: string,
|
|
468
|
-
status: AIRunGateStatus,
|
|
469
|
-
reason: string,
|
|
470
|
-
evidenceRefs: string[] = [],
|
|
471
|
-
now?: Date | string,
|
|
472
|
-
metadata?: Record<string, any>
|
|
473
|
-
): AIRunGateResult {
|
|
474
|
-
return {
|
|
475
|
-
key,
|
|
476
|
-
label,
|
|
477
|
-
status,
|
|
478
|
-
reason: cleanText(reason, 1400),
|
|
479
|
-
evidenceRefs: cleanList(evidenceRefs, 20, 500),
|
|
480
|
-
recordedAt: isoNow(now),
|
|
481
|
-
...(metadata ? { metadata } : {})
|
|
482
|
-
};
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
function failedOrBlocked(status: AIQaCheckStatus | AIQaCompileStatus): boolean {
|
|
486
|
-
return status === 'fail' || status === 'blocked';
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
function passed(status: AIQaCheckStatus | AIQaCompileStatus): boolean {
|
|
490
|
-
return status === 'pass';
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
function normalizeInfraChecks(values: AIQaInfraCheck[] | undefined): AIQaInfraCheck[] {
|
|
494
|
-
return (Array.isArray(values) ? values : []).map((entry) => ({
|
|
495
|
-
...entry,
|
|
496
|
-
name: cleanText(entry?.name, 120) || 'infra_check',
|
|
497
|
-
status: normalizeCheckStatus(entry?.status),
|
|
498
|
-
message: cleanText(entry?.message, 1000),
|
|
499
|
-
path: cleanText(entry?.path, 500)
|
|
500
|
-
}));
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
function normalizeRouteProbes(values: AIQaRouteProbe[] | undefined): AIQaRouteProbe[] {
|
|
504
|
-
return (Array.isArray(values) ? values : []).map((entry) => ({
|
|
505
|
-
...entry,
|
|
506
|
-
route: cleanText(entry?.route, 500) || '/',
|
|
507
|
-
status: normalizeCheckStatus(entry?.status),
|
|
508
|
-
screenshot: cleanText(entry?.screenshot, 500),
|
|
509
|
-
caption: cleanText(entry?.caption, 1000),
|
|
510
|
-
message: cleanText(entry?.message, 1000),
|
|
511
|
-
consoleErrors: cleanList(entry?.consoleErrors, 30, 500),
|
|
512
|
-
networkErrors: cleanList(entry?.networkErrors, 30, 500)
|
|
513
|
-
}));
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
function normalizeBusinessAssertions(values: AIQaBusinessAssertion[] | undefined): AIQaBusinessAssertion[] {
|
|
517
|
-
return (Array.isArray(values) ? values : []).map((entry) => ({
|
|
518
|
-
...entry,
|
|
519
|
-
assertion: cleanText(entry?.assertion, 1000) || 'business assertion',
|
|
520
|
-
status: normalizeCheckStatus(entry?.status),
|
|
521
|
-
workflow: cleanText(entry?.workflow, 400),
|
|
522
|
-
route: cleanText(entry?.route, 500),
|
|
523
|
-
action: cleanText(entry?.action, 500),
|
|
524
|
-
expected: cleanText(entry?.expected, 1000),
|
|
525
|
-
observed: cleanText(entry?.observed, 1000),
|
|
526
|
-
dataProof: cleanText(entry?.dataProof, 1400),
|
|
527
|
-
artifactPaths: cleanList(entry?.artifactPaths, 30, 500),
|
|
528
|
-
message: cleanText(entry?.message, 1000)
|
|
529
|
-
}));
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
function collectBusinessAssertionArtifactPaths(assertions: AIQaBusinessAssertion[]): string[] {
|
|
533
|
-
const paths: string[] = [];
|
|
534
|
-
for (const assertion of assertions) {
|
|
535
|
-
for (const artifactPath of assertion.artifactPaths || []) {
|
|
536
|
-
if (artifactPath && !paths.includes(artifactPath)) {
|
|
537
|
-
paths.push(artifactPath);
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
return paths;
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
export function buildAIQaRun(input: AIQaEvaluationInput = {}): AIQaRun {
|
|
545
|
-
const now = isoNow(input.now);
|
|
546
|
-
const infraChecks = normalizeInfraChecks(input.infraChecks);
|
|
547
|
-
const compile = input.compile
|
|
548
|
-
? {
|
|
549
|
-
...input.compile,
|
|
550
|
-
status: normalizeCompileStatus(input.compile.status),
|
|
551
|
-
command: cleanText(input.compile.command, 500),
|
|
552
|
-
artifactPath: cleanText(input.compile.artifactPath, 500),
|
|
553
|
-
message: cleanText(input.compile.message, 1000)
|
|
554
|
-
}
|
|
555
|
-
: undefined;
|
|
556
|
-
const routeProbes = normalizeRouteProbes(input.routeProbes);
|
|
557
|
-
const businessAssertions = normalizeBusinessAssertions(input.businessAssertions);
|
|
558
|
-
const artifacts = Array.isArray(input.artifacts) ? input.artifacts : [];
|
|
559
|
-
const gateResults: AIRunGateResult[] = [];
|
|
560
|
-
|
|
561
|
-
const failedInfra = infraChecks.filter((check) => failedOrBlocked(check.status));
|
|
562
|
-
if (failedInfra.length) {
|
|
563
|
-
gateResults.push(makeGate(
|
|
564
|
-
'qa_infra',
|
|
565
|
-
'QA infrastructure',
|
|
566
|
-
'blocked',
|
|
567
|
-
`QA infrastructure failed before model/business validation: ${failedInfra.map((check) => `${check.name}: ${check.message || check.status}`).join('; ')}`,
|
|
568
|
-
failedInfra.map((check) => check.path || '').filter(Boolean),
|
|
569
|
-
now,
|
|
570
|
-
{ failed_checks: failedInfra.map((check) => check.name) }
|
|
571
|
-
));
|
|
572
|
-
return { outcome: 'infra_failed', infraChecks, compile, routeProbes, businessAssertions, artifacts, gateResults, updatedAt: now };
|
|
573
|
-
}
|
|
574
|
-
if (infraChecks.length) {
|
|
575
|
-
gateResults.push(makeGate('qa_infra', 'QA infrastructure', 'pass', 'QA infrastructure preflight checks passed.', [], now));
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
if (compile && (failedOrBlocked(compile.status) || compile.status === 'stale' || compile.staleEvidence === true)) {
|
|
579
|
-
gateResults.push(makeGate(
|
|
580
|
-
'qa_compile',
|
|
581
|
-
'Compile/build',
|
|
582
|
-
'fail',
|
|
583
|
-
compile.status === 'stale' || compile.staleEvidence === true
|
|
584
|
-
? 'Compile/build evidence is stale and cannot be used for acceptance.'
|
|
585
|
-
: (compile.message || 'Compile/build failed before browser QA.'),
|
|
586
|
-
compile.artifactPath ? [compile.artifactPath] : [],
|
|
587
|
-
now,
|
|
588
|
-
{ command: compile.command || '' }
|
|
589
|
-
));
|
|
590
|
-
return { outcome: 'compile_failed', infraChecks, compile, routeProbes, businessAssertions, artifacts, gateResults, updatedAt: now };
|
|
591
|
-
}
|
|
592
|
-
if (compile && passed(compile.status)) {
|
|
593
|
-
gateResults.push(makeGate('qa_compile', 'Compile/build', 'pass', 'Compile/build evidence passed.', compile.artifactPath ? [compile.artifactPath] : [], now));
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
const failedRouteProbes = routeProbes.filter((probe) => failedOrBlocked(probe.status) || probe.shellOnly === true);
|
|
597
|
-
if (failedRouteProbes.length) {
|
|
598
|
-
gateResults.push(makeGate(
|
|
599
|
-
'qa_route_probe',
|
|
600
|
-
'Browser route probe',
|
|
601
|
-
'fail',
|
|
602
|
-
`Browser route probe failed or showed shell-only UI: ${failedRouteProbes.map((probe) => `${probe.route}: ${probe.message || probe.caption || probe.status}`).join('; ')}`,
|
|
603
|
-
failedRouteProbes.map((probe) => probe.screenshot || '').filter(Boolean),
|
|
604
|
-
now
|
|
605
|
-
));
|
|
606
|
-
return { outcome: 'route_failed', infraChecks, compile, routeProbes, businessAssertions, artifacts, gateResults, updatedAt: now };
|
|
607
|
-
}
|
|
608
|
-
if (routeProbes.some((probe) => passed(probe.status))) {
|
|
609
|
-
gateResults.push(makeGate(
|
|
610
|
-
'qa_route_probe',
|
|
611
|
-
'Browser route probe',
|
|
612
|
-
'pass',
|
|
613
|
-
'Browser route reached authenticated application content. This is not business acceptance by itself.',
|
|
614
|
-
routeProbes.map((probe) => probe.screenshot || '').filter(Boolean),
|
|
615
|
-
now
|
|
616
|
-
));
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
const failedBusinessAssertions = businessAssertions.filter((assertion) => failedOrBlocked(assertion.status));
|
|
620
|
-
if (failedBusinessAssertions.length) {
|
|
621
|
-
gateResults.push(makeGate(
|
|
622
|
-
'qa_business_assertion',
|
|
623
|
-
'Business assertion',
|
|
624
|
-
'fail',
|
|
625
|
-
`Issue-specific workflow assertion failed: ${failedBusinessAssertions.map((assertion) => assertion.message || assertion.observed || assertion.assertion).join('; ')}`,
|
|
626
|
-
collectBusinessAssertionArtifactPaths(failedBusinessAssertions),
|
|
627
|
-
now
|
|
628
|
-
));
|
|
629
|
-
return { outcome: 'business_assertion_failed', infraChecks, compile, routeProbes, businessAssertions, artifacts, gateResults, updatedAt: now };
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
const passedBusinessAssertions = businessAssertions.filter((assertion) => passed(assertion.status));
|
|
633
|
-
if (passedBusinessAssertions.length) {
|
|
634
|
-
gateResults.push(makeGate(
|
|
635
|
-
'qa_business_assertion',
|
|
636
|
-
'Business assertion',
|
|
637
|
-
'pass',
|
|
638
|
-
'At least one issue-specific workflow/data assertion passed.',
|
|
639
|
-
collectBusinessAssertionArtifactPaths(passedBusinessAssertions),
|
|
640
|
-
now,
|
|
641
|
-
{ passed_assertions: passedBusinessAssertions.map((assertion) => assertion.assertion) }
|
|
642
|
-
));
|
|
643
|
-
return { outcome: 'business_assertion_passed', infraChecks, compile, routeProbes, businessAssertions, artifacts, gateResults, updatedAt: now };
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
if (routeProbes.some((probe) => passed(probe.status))) {
|
|
647
|
-
gateResults.push(makeGate(
|
|
648
|
-
'qa_business_assertion',
|
|
649
|
-
'Business assertion',
|
|
650
|
-
'blocked',
|
|
651
|
-
'Browser route loaded, but no issue-specific business assertion passed. Route-only proof cannot accept the run.',
|
|
652
|
-
[],
|
|
653
|
-
now
|
|
654
|
-
));
|
|
655
|
-
return { outcome: 'route_only_pass', infraChecks, compile, routeProbes, businessAssertions, artifacts, gateResults, updatedAt: now };
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
gateResults.push(makeGate(
|
|
659
|
-
'qa_business_assertion',
|
|
660
|
-
'Business assertion',
|
|
661
|
-
'blocked',
|
|
662
|
-
'No issue-specific QA assertion was recorded.',
|
|
663
|
-
[],
|
|
664
|
-
now
|
|
665
|
-
));
|
|
666
|
-
return { outcome: 'incomplete', infraChecks, compile, routeProbes, businessAssertions, artifacts, gateResults, updatedAt: now };
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
function normalizeQaRun(input?: AIQaRun | AIQaEvaluationInput): AIQaRun | undefined {
|
|
670
|
-
if (!input) {
|
|
671
|
-
return undefined;
|
|
672
|
-
}
|
|
673
|
-
if ((input as AIQaRun).outcome && Array.isArray((input as AIQaRun).gateResults)) {
|
|
674
|
-
return input as AIQaRun;
|
|
675
|
-
}
|
|
676
|
-
return buildAIQaRun(input as AIQaEvaluationInput);
|
|
677
|
-
}
|
|
678
|
-
|
|
679
|
-
function statusLooksFailed(value: any): boolean {
|
|
680
|
-
const normalized = cleanText(value, 120).toLowerCase();
|
|
681
|
-
return !!normalized && /(fail|failed|error|blocked|missing|empty|stale|skipped|not ready|not_ready|could not|cannot)/i.test(normalized);
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
function statusLooksPassed(value: any): boolean {
|
|
685
|
-
const normalized = cleanText(value, 120).toLowerCase();
|
|
686
|
-
return !!normalized && /(pass|passed|success|complete|completed|ready|published|deployed|live|merged)/i.test(normalized);
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
function addGateOnce(gates: AIRunGateResult[], gate: AIRunGateResult): void {
|
|
690
|
-
if (gates.some((entry) => entry.key === gate.key && entry.status === gate.status && entry.reason === gate.reason)) {
|
|
691
|
-
return;
|
|
692
|
-
}
|
|
693
|
-
gates.push(gate);
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
export function classifyAIRunOutcome(input: AIRunOutcomeInput = {}): AIRunOutcomeDecision {
|
|
697
|
-
const now = isoNow(input.now);
|
|
698
|
-
const gates = Array.isArray(input.gates) ? [...input.gates] : [];
|
|
699
|
-
const warnings: string[] = [];
|
|
700
|
-
const qa = normalizeQaRun(input.qa);
|
|
701
|
-
if (qa) {
|
|
702
|
-
for (const gate of qa.gateResults) {
|
|
703
|
-
addGateOnce(gates, gate);
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
if (input.manualHandoff === true) {
|
|
708
|
-
return {
|
|
709
|
-
outcome: 'manual_handoff',
|
|
710
|
-
reason: 'Run requires manual handoff.',
|
|
711
|
-
nextAction: 'Ask a human operator to resolve the blocked run.',
|
|
712
|
-
gates,
|
|
713
|
-
warnings,
|
|
714
|
-
recordedAt: now
|
|
715
|
-
};
|
|
716
|
-
}
|
|
717
|
-
if (input.stopped === true || /stop|stopped|cancel|cancelled|paused/i.test(`${input.status || ''} ${input.phase || ''}`)) {
|
|
718
|
-
return {
|
|
719
|
-
outcome: 'stopped',
|
|
720
|
-
reason: 'Run was stopped before accepted evidence was recorded.',
|
|
721
|
-
nextAction: 'Resume or restart only if the request is still active.',
|
|
722
|
-
gates,
|
|
723
|
-
warnings,
|
|
724
|
-
recordedAt: now
|
|
725
|
-
};
|
|
726
|
-
}
|
|
727
|
-
if (input.rejected === true) {
|
|
728
|
-
return {
|
|
729
|
-
outcome: 'rejected',
|
|
730
|
-
reason: 'Run was explicitly rejected.',
|
|
731
|
-
nextAction: 'Start a repair run from the failing evidence.',
|
|
732
|
-
gates,
|
|
733
|
-
warnings,
|
|
734
|
-
recordedAt: now
|
|
735
|
-
};
|
|
736
|
-
}
|
|
737
|
-
|
|
738
|
-
if (qa?.outcome === 'infra_failed') {
|
|
739
|
-
return {
|
|
740
|
-
outcome: 'qa_infra_failed',
|
|
741
|
-
reason: 'QA infrastructure failed before product validation.',
|
|
742
|
-
nextAction: 'Repair QA harness dependencies, ports, browser, Mongo, or startup before another model repair loop.',
|
|
743
|
-
gates,
|
|
744
|
-
warnings,
|
|
745
|
-
recordedAt: now
|
|
746
|
-
};
|
|
747
|
-
}
|
|
748
|
-
if (qa?.outcome === 'compile_failed') {
|
|
749
|
-
return {
|
|
750
|
-
outcome: 'build_failed',
|
|
751
|
-
reason: 'Compile/build evidence failed or was stale.',
|
|
752
|
-
nextAction: 'Repair compile/build first, then rerun QA from the same failed step.',
|
|
753
|
-
gates,
|
|
754
|
-
warnings,
|
|
755
|
-
recordedAt: now
|
|
756
|
-
};
|
|
757
|
-
}
|
|
758
|
-
if (qa?.outcome === 'route_failed') {
|
|
759
|
-
return {
|
|
760
|
-
outcome: 'qa_incomplete',
|
|
761
|
-
reason: 'Browser route probe failed before business proof.',
|
|
762
|
-
nextAction: 'Repair route/auth/startup issue and rerun the same browser route probe.',
|
|
763
|
-
gates,
|
|
764
|
-
warnings,
|
|
765
|
-
recordedAt: now
|
|
766
|
-
};
|
|
767
|
-
}
|
|
768
|
-
if (qa?.outcome === 'route_only_pass' || qa?.outcome === 'incomplete') {
|
|
769
|
-
return {
|
|
770
|
-
outcome: input.scorecardPassed === true ? 'false_pass' : 'qa_incomplete',
|
|
771
|
-
reason: input.scorecardPassed === true
|
|
772
|
-
? 'Scorecard or workflow status passed without issue-specific business assertion proof.'
|
|
773
|
-
: 'QA has not recorded issue-specific business assertion proof.',
|
|
774
|
-
nextAction: 'Add before/action/after workflow proof with screenshot/data assertions before acceptance.',
|
|
775
|
-
gates,
|
|
776
|
-
warnings,
|
|
777
|
-
recordedAt: now
|
|
778
|
-
};
|
|
779
|
-
}
|
|
780
|
-
if (qa?.outcome === 'business_assertion_failed') {
|
|
781
|
-
return {
|
|
782
|
-
outcome: input.terminal === true ? 'rejected' : 'qa_incomplete',
|
|
783
|
-
reason: 'Issue-specific business assertion failed.',
|
|
784
|
-
nextAction: 'Repair the product/data defect and rerun the failing assertion.',
|
|
785
|
-
gates,
|
|
786
|
-
warnings,
|
|
787
|
-
recordedAt: now
|
|
788
|
-
};
|
|
789
|
-
}
|
|
790
|
-
|
|
791
|
-
const hasBusinessPass = qa?.outcome === 'business_assertion_passed';
|
|
792
|
-
const scorecardPassed = input.scorecardPassed === true || statusLooksPassed(input.scorecardStatus);
|
|
793
|
-
const releaseBlockers: string[] = [];
|
|
794
|
-
if (statusLooksFailed(input.deployStatus)) {
|
|
795
|
-
releaseBlockers.push(`deploy=${cleanText(input.deployStatus, 120)}`);
|
|
796
|
-
}
|
|
797
|
-
if (statusLooksFailed(input.publishStatus)) {
|
|
798
|
-
releaseBlockers.push(`publish=${cleanText(input.publishStatus, 120)}`);
|
|
799
|
-
}
|
|
800
|
-
if (statusLooksFailed(input.sampleDataStatus)) {
|
|
801
|
-
releaseBlockers.push(`sample_data=${cleanText(input.sampleDataStatus, 120)}`);
|
|
802
|
-
}
|
|
803
|
-
if (releaseBlockers.length && (scorecardPassed || hasBusinessPass)) {
|
|
804
|
-
addGateOnce(gates, makeGate(
|
|
805
|
-
'release',
|
|
806
|
-
'Release/deploy',
|
|
807
|
-
'fail',
|
|
808
|
-
`Final acceptance is blocked after QA/scorecard because release gates failed: ${releaseBlockers.join(', ')}.`,
|
|
809
|
-
[],
|
|
810
|
-
now
|
|
811
|
-
));
|
|
812
|
-
return {
|
|
813
|
-
outcome: 'release_blocked',
|
|
814
|
-
reason: `Release gates failed after QA/scorecard: ${releaseBlockers.join(', ')}.`,
|
|
815
|
-
nextAction: 'Repair deploy/publish/sample-data coverage before marking the run accepted.',
|
|
816
|
-
gates,
|
|
817
|
-
warnings,
|
|
818
|
-
recordedAt: now
|
|
819
|
-
};
|
|
820
|
-
}
|
|
821
|
-
|
|
822
|
-
if (scorecardPassed && !hasBusinessPass) {
|
|
823
|
-
warnings.push('scorecard_pass_without_business_assertion');
|
|
824
|
-
addGateOnce(gates, makeGate(
|
|
825
|
-
'business_assertion_required',
|
|
826
|
-
'Business assertion',
|
|
827
|
-
'blocked',
|
|
828
|
-
'Scorecard passed, but no issue-specific business assertion proof was recorded.',
|
|
829
|
-
[],
|
|
830
|
-
now
|
|
831
|
-
));
|
|
832
|
-
return {
|
|
833
|
-
outcome: 'false_pass',
|
|
834
|
-
reason: 'Scorecard-only proof is not acceptance.',
|
|
835
|
-
nextAction: 'Record issue-specific workflow/data proof, then reclassify the run.',
|
|
836
|
-
gates,
|
|
837
|
-
warnings,
|
|
838
|
-
recordedAt: now
|
|
839
|
-
};
|
|
840
|
-
}
|
|
841
|
-
|
|
842
|
-
const statusPhase = `${input.status || ''} ${input.phase || ''}`;
|
|
843
|
-
if ((input.explicitAccepted === true || statusLooksPassed(statusPhase) || scorecardPassed) && hasBusinessPass) {
|
|
844
|
-
return {
|
|
845
|
-
outcome: 'accepted',
|
|
846
|
-
reason: 'Run has terminal success signal and issue-specific business assertion proof.',
|
|
847
|
-
nextAction: 'No repair action required.',
|
|
848
|
-
gates,
|
|
849
|
-
warnings,
|
|
850
|
-
recordedAt: now
|
|
851
|
-
};
|
|
852
|
-
}
|
|
853
|
-
|
|
854
|
-
if (statusLooksFailed(statusPhase)) {
|
|
855
|
-
return {
|
|
856
|
-
outcome: 'rejected',
|
|
857
|
-
reason: 'Run ended with a failure status and no accepted proof.',
|
|
858
|
-
nextAction: 'Classify the failing gate and rerun the smallest repair step.',
|
|
859
|
-
gates,
|
|
860
|
-
warnings,
|
|
861
|
-
recordedAt: now
|
|
862
|
-
};
|
|
863
|
-
}
|
|
864
|
-
|
|
865
|
-
return {
|
|
866
|
-
outcome: 'unknown',
|
|
867
|
-
reason: 'Run does not have enough normalized evidence for a terminal label.',
|
|
868
|
-
nextAction: 'Ingest QA, deploy, assistant, usage, and commit evidence before using this run for training.',
|
|
869
|
-
gates,
|
|
870
|
-
warnings,
|
|
871
|
-
recordedAt: now
|
|
872
|
-
};
|
|
873
|
-
}
|
|
874
|
-
|
|
875
|
-
export function buildAIRun(input: Omit<AIRun, 'outcome' | 'gates'> & {
|
|
876
|
-
outcome?: AIRunOutcomeLabel;
|
|
877
|
-
gates?: AIRunGateResult[];
|
|
878
|
-
scorecardPassed?: boolean;
|
|
879
|
-
deployStatus?: string;
|
|
880
|
-
publishStatus?: string;
|
|
881
|
-
sampleDataStatus?: string;
|
|
882
|
-
manualHandoff?: boolean;
|
|
883
|
-
stopped?: boolean;
|
|
884
|
-
rejected?: boolean;
|
|
885
|
-
explicitAccepted?: boolean;
|
|
886
|
-
terminal?: boolean;
|
|
887
|
-
now?: Date | string;
|
|
888
|
-
}): AIRun {
|
|
889
|
-
const decision = input.outcome
|
|
890
|
-
? {
|
|
891
|
-
outcome: input.outcome,
|
|
892
|
-
gates: input.gates || [],
|
|
893
|
-
warnings: input.warnings || [],
|
|
894
|
-
nextAction: input.nextAction || '',
|
|
895
|
-
reason: '',
|
|
896
|
-
recordedAt: isoNow(input.now)
|
|
897
|
-
}
|
|
898
|
-
: classifyAIRunOutcome({
|
|
899
|
-
source: input.source,
|
|
900
|
-
status: input.status,
|
|
901
|
-
phase: input.phase,
|
|
902
|
-
qa: input.qa,
|
|
903
|
-
gates: input.gates,
|
|
904
|
-
scorecardPassed: input.scorecardPassed,
|
|
905
|
-
deployStatus: input.deployStatus,
|
|
906
|
-
publishStatus: input.publishStatus,
|
|
907
|
-
sampleDataStatus: input.sampleDataStatus,
|
|
908
|
-
manualHandoff: input.manualHandoff,
|
|
909
|
-
stopped: input.stopped,
|
|
910
|
-
rejected: input.rejected,
|
|
911
|
-
explicitAccepted: input.explicitAccepted,
|
|
912
|
-
terminal: input.terminal,
|
|
913
|
-
now: input.now
|
|
914
|
-
});
|
|
915
|
-
return {
|
|
916
|
-
id: input.id,
|
|
917
|
-
source: input.source || 'unknown',
|
|
918
|
-
sourceIds: input.sourceIds || {},
|
|
919
|
-
title: input.title,
|
|
920
|
-
status: input.status,
|
|
921
|
-
phase: input.phase,
|
|
922
|
-
startedAt: input.startedAt,
|
|
923
|
-
completedAt: input.completedAt,
|
|
924
|
-
outcome: decision.outcome,
|
|
925
|
-
events: Array.isArray(input.events) ? input.events : [],
|
|
926
|
-
gates: decision.gates,
|
|
927
|
-
qa: normalizeQaRun(input.qa),
|
|
928
|
-
cost: input.cost,
|
|
929
|
-
nextAction: decision.nextAction,
|
|
930
|
-
warnings: decision.warnings,
|
|
931
|
-
metadata: input.metadata
|
|
932
|
-
};
|
|
933
|
-
}
|
|
934
|
-
|
|
935
|
-
export function buildAIRunCost(entries: OpenAIUsageCostEntry[] = []): AIRunCost {
|
|
936
|
-
const cost: AIRunCost = {
|
|
937
|
-
inputTokens: 0,
|
|
938
|
-
cachedInputTokens: 0,
|
|
939
|
-
outputTokens: 0,
|
|
940
|
-
totalTokens: 0,
|
|
941
|
-
estimatedUsd: 0,
|
|
942
|
-
models: [],
|
|
943
|
-
categories: {},
|
|
944
|
-
sources: {},
|
|
945
|
-
surfaces: {},
|
|
946
|
-
manualEstimatedUsd: 0,
|
|
947
|
-
untrackedEstimatedUsd: 0,
|
|
948
|
-
untrackedWarnings: []
|
|
949
|
-
};
|
|
950
|
-
for (const entry of normalizeOpenAIUsageRowsForCosting(entries)) {
|
|
951
|
-
const category = cleanText(entry.category, 120) || 'unknown';
|
|
952
|
-
const source = cleanText(entry.usage_source ?? entry.usageSource, 80) || 'unknown';
|
|
953
|
-
const surface = cleanText(entry.usage_surface ?? entry.usageSurface, 80) || 'unknown';
|
|
954
|
-
const isManual = entry.is_manual === true || entry.isManual === true || source === 'manual_codex';
|
|
955
|
-
const isUntracked = entry.is_untracked === true || entry.isUntracked === true;
|
|
956
|
-
const untrackedReason = cleanText(entry.untracked_reason ?? entry.untrackedReason, 500);
|
|
957
|
-
const model = cleanText(entry.model, 120);
|
|
958
|
-
const inputTokens = Number(entry.input_tokens ?? entry.inputTokens ?? 0) || 0;
|
|
959
|
-
const cachedInputTokens = Number(entry.cached_input_tokens ?? entry.cachedInputTokens ?? 0) || 0;
|
|
960
|
-
const outputTokens = Number(entry.output_tokens ?? entry.outputTokens ?? 0) || 0;
|
|
961
|
-
const totalTokens = Number(entry.total_tokens ?? entry.totalTokens ?? (inputTokens + outputTokens)) || 0;
|
|
962
|
-
const estimatedUsd = Number(entry.cost_estimate ?? entry.estimatedUsd ?? 0) || 0;
|
|
963
|
-
cost.inputTokens += inputTokens;
|
|
964
|
-
cost.cachedInputTokens += cachedInputTokens;
|
|
965
|
-
cost.outputTokens += outputTokens;
|
|
966
|
-
cost.totalTokens += totalTokens;
|
|
967
|
-
cost.estimatedUsd += estimatedUsd;
|
|
968
|
-
if (isManual) {
|
|
969
|
-
cost.manualEstimatedUsd = Number(cost.manualEstimatedUsd || 0) + estimatedUsd;
|
|
970
|
-
}
|
|
971
|
-
if (isUntracked) {
|
|
972
|
-
cost.untrackedEstimatedUsd = Number(cost.untrackedEstimatedUsd || 0) + estimatedUsd;
|
|
973
|
-
const warning = untrackedReason || `${source} usage is an estimate outside managed runner telemetry.`;
|
|
974
|
-
if (warning && !cost.untrackedWarnings?.includes(warning)) {
|
|
975
|
-
cost.untrackedWarnings?.push(warning);
|
|
976
|
-
}
|
|
977
|
-
}
|
|
978
|
-
if (model && !cost.models.includes(model)) {
|
|
979
|
-
cost.models.push(model);
|
|
980
|
-
}
|
|
981
|
-
if (!cost.categories[category]) {
|
|
982
|
-
cost.categories[category] = {
|
|
983
|
-
inputTokens: 0,
|
|
984
|
-
cachedInputTokens: 0,
|
|
985
|
-
outputTokens: 0,
|
|
986
|
-
totalTokens: 0,
|
|
987
|
-
estimatedUsd: 0,
|
|
988
|
-
count: 0
|
|
989
|
-
};
|
|
990
|
-
}
|
|
991
|
-
cost.categories[category].inputTokens += inputTokens;
|
|
992
|
-
cost.categories[category].cachedInputTokens += cachedInputTokens;
|
|
993
|
-
cost.categories[category].outputTokens += outputTokens;
|
|
994
|
-
cost.categories[category].totalTokens += totalTokens;
|
|
995
|
-
cost.categories[category].estimatedUsd += estimatedUsd;
|
|
996
|
-
cost.categories[category].count += 1;
|
|
997
|
-
if (!cost.sources?.[source]) {
|
|
998
|
-
cost.sources![source] = {
|
|
999
|
-
inputTokens: 0,
|
|
1000
|
-
cachedInputTokens: 0,
|
|
1001
|
-
outputTokens: 0,
|
|
1002
|
-
totalTokens: 0,
|
|
1003
|
-
estimatedUsd: 0,
|
|
1004
|
-
count: 0,
|
|
1005
|
-
manualCount: 0,
|
|
1006
|
-
untrackedCount: 0
|
|
1007
|
-
};
|
|
1008
|
-
}
|
|
1009
|
-
cost.sources[source].inputTokens += inputTokens;
|
|
1010
|
-
cost.sources[source].cachedInputTokens += cachedInputTokens;
|
|
1011
|
-
cost.sources[source].outputTokens += outputTokens;
|
|
1012
|
-
cost.sources[source].totalTokens += totalTokens;
|
|
1013
|
-
cost.sources[source].estimatedUsd += estimatedUsd;
|
|
1014
|
-
cost.sources[source].count += 1;
|
|
1015
|
-
if (isManual) {
|
|
1016
|
-
cost.sources[source].manualCount += 1;
|
|
1017
|
-
}
|
|
1018
|
-
if (isUntracked) {
|
|
1019
|
-
cost.sources[source].untrackedCount += 1;
|
|
1020
|
-
}
|
|
1021
|
-
if (!cost.surfaces?.[surface]) {
|
|
1022
|
-
cost.surfaces![surface] = {
|
|
1023
|
-
totalTokens: 0,
|
|
1024
|
-
estimatedUsd: 0,
|
|
1025
|
-
count: 0
|
|
1026
|
-
};
|
|
1027
|
-
}
|
|
1028
|
-
cost.surfaces[surface].totalTokens += totalTokens;
|
|
1029
|
-
cost.surfaces[surface].estimatedUsd += estimatedUsd;
|
|
1030
|
-
cost.surfaces[surface].count += 1;
|
|
1031
|
-
}
|
|
1032
|
-
cost.estimatedUsd = Number(cost.estimatedUsd.toFixed(6));
|
|
1033
|
-
cost.manualEstimatedUsd = Number(Number(cost.manualEstimatedUsd || 0).toFixed(6));
|
|
1034
|
-
cost.untrackedEstimatedUsd = Number(Number(cost.untrackedEstimatedUsd || 0).toFixed(6));
|
|
1035
|
-
for (const category of Object.keys(cost.categories)) {
|
|
1036
|
-
cost.categories[category].estimatedUsd = Number(cost.categories[category].estimatedUsd.toFixed(6));
|
|
1037
|
-
}
|
|
1038
|
-
for (const source of Object.keys(cost.sources || {})) {
|
|
1039
|
-
cost.sources![source].estimatedUsd = Number(cost.sources![source].estimatedUsd.toFixed(6));
|
|
1040
|
-
}
|
|
1041
|
-
for (const surface of Object.keys(cost.surfaces || {})) {
|
|
1042
|
-
cost.surfaces![surface].estimatedUsd = Number(cost.surfaces![surface].estimatedUsd.toFixed(6));
|
|
1043
|
-
}
|
|
1044
|
-
return cost;
|
|
1045
|
-
}
|
|
1046
|
-
|
|
1047
|
-
export function redactAIRunTrainingExample(example: AIRunTrainingExample): AIRunTrainingExample {
|
|
1048
|
-
const redact = (value: string): string => cleanText(value, 5000)
|
|
1049
|
-
.replace(/mongodb(?:\+srv)?:\/\/[^\s"'<>]+/ig, '[redacted-mongo-url]')
|
|
1050
|
-
.replace(/\b(?:sk|ghp|xoxb|AKIA)[A-Za-z0-9_\-]{12,}\b/g, '[redacted-secret]')
|
|
1051
|
-
.replace(/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z]{2,}\b/ig, '[redacted-email]');
|
|
1052
|
-
return {
|
|
1053
|
-
...example,
|
|
1054
|
-
inputSummary: redact(example.inputSummary),
|
|
1055
|
-
actionSummary: redact(example.actionSummary),
|
|
1056
|
-
evidence: cleanList(example.evidence, 80, 5000).map(redact)
|
|
1057
|
-
};
|
|
1058
|
-
}
|