@resolveio/server-lib 22.3.197 → 22.3.198
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 +338 -0
- package/methods/ai-terminal.js +23454 -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 +109 -0
- package/util/ai-run-evidence-adapters.js +4255 -0
- package/util/ai-run-evidence-adapters.js.map +1 -0
- package/util/ai-run-evidence-dashboard.d.ts +88 -0
- package/util/ai-run-evidence-dashboard.js +343 -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 +1018 -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 +852 -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 +210 -0
- package/util/ai-runner-manager-autopilot.js +642 -0
- package/util/ai-runner-manager-autopilot.js.map +1 -0
- package/util/ai-runner-manager-policy.d.ts +787 -0
- package/util/ai-runner-manager-policy.js +3342 -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 +424 -0
- package/util/aicoder-runner-v6.js +2325 -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 +1055 -0
- package/util/support-runner-v5.js +4808 -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 -23825
- 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 -4642
- package/src/util/ai-run-evidence-dashboard.ts +0 -323
- package/src/util/ai-run-evidence-eval.ts +0 -1057
- package/src/util/ai-run-evidence.ts +0 -1185
- package/src/util/ai-runner-artifacts.ts +0 -586
- package/src/util/ai-runner-manager-autopilot.ts +0 -961
- package/src/util/ai-runner-manager-policy.ts +0 -4806
- 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 -2979
- 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 -6573
- 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 -3057
- package/tests/ai-manager-autopilot-snapshot.test.ts +0 -193
- package/tests/ai-manager-recovery-checkpoint.test.ts +0 -1287
- package/tests/ai-run-eval.test.ts +0 -132
- package/tests/ai-run-evidence.test.ts +0 -2129
- package/tests/ai-runner-contract.test.ts +0 -488
- package/tests/aicoder-runner-v6.test.ts +0 -751
- 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 -1473
- 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
|
@@ -0,0 +1,852 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __values = (this && this.__values) || function(o) {
|
|
14
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
15
|
+
if (m) return m.call(o);
|
|
16
|
+
if (o && typeof o.length === "number") return {
|
|
17
|
+
next: function () {
|
|
18
|
+
if (o && i >= o.length) o = void 0;
|
|
19
|
+
return { value: o && o[i++], done: !o };
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
23
|
+
};
|
|
24
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
25
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
26
|
+
if (!m) return o;
|
|
27
|
+
var i = m.call(o), r, ar = [], e;
|
|
28
|
+
try {
|
|
29
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
30
|
+
}
|
|
31
|
+
catch (error) { e = { error: error }; }
|
|
32
|
+
finally {
|
|
33
|
+
try {
|
|
34
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
35
|
+
}
|
|
36
|
+
finally { if (e) throw e.error; }
|
|
37
|
+
}
|
|
38
|
+
return ar;
|
|
39
|
+
};
|
|
40
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
41
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
42
|
+
if (ar || !(i in from)) {
|
|
43
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
44
|
+
ar[i] = from[i];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
48
|
+
};
|
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
exports.isCumulativeCodexUsageEntry = isCumulativeCodexUsageEntry;
|
|
51
|
+
exports.resolveOpenAIUsageThreadKey = resolveOpenAIUsageThreadKey;
|
|
52
|
+
exports.normalizeOpenAIUsageRowsForCosting = normalizeOpenAIUsageRowsForCosting;
|
|
53
|
+
exports.buildAIQaRun = buildAIQaRun;
|
|
54
|
+
exports.classifyAIRunOutcome = classifyAIRunOutcome;
|
|
55
|
+
exports.buildAIRun = buildAIRun;
|
|
56
|
+
exports.buildAIRunCost = buildAIRunCost;
|
|
57
|
+
exports.redactAIRunTrainingExample = redactAIRunTrainingExample;
|
|
58
|
+
function isoNow(value) {
|
|
59
|
+
if (value instanceof Date) {
|
|
60
|
+
return value.toISOString();
|
|
61
|
+
}
|
|
62
|
+
var parsed = value ? new Date(value) : new Date();
|
|
63
|
+
if (Number.isFinite(parsed.getTime())) {
|
|
64
|
+
return parsed.toISOString();
|
|
65
|
+
}
|
|
66
|
+
return new Date().toISOString();
|
|
67
|
+
}
|
|
68
|
+
function cleanText(value, max) {
|
|
69
|
+
if (max === void 0) { max = 1000; }
|
|
70
|
+
return String(value || '').replace(/\s+/g, ' ').trim().slice(0, max);
|
|
71
|
+
}
|
|
72
|
+
function cleanUsageNumber(value) {
|
|
73
|
+
var parsed = Number(value);
|
|
74
|
+
return Number.isFinite(parsed) ? parsed : 0;
|
|
75
|
+
}
|
|
76
|
+
function cleanUsageDate(value) {
|
|
77
|
+
if (!value) {
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
var date = value instanceof Date ? value : new Date(value);
|
|
81
|
+
return Number.isFinite(date.getTime()) ? date : undefined;
|
|
82
|
+
}
|
|
83
|
+
function isCumulativeCodexUsageEntry(entry) {
|
|
84
|
+
return cleanText(entry === null || entry === void 0 ? void 0 : entry.category, 180).toLowerCase().startsWith('ai-dashboard-codex:');
|
|
85
|
+
}
|
|
86
|
+
function resolveOpenAIUsageThreadKey(entry) {
|
|
87
|
+
var _a, _b;
|
|
88
|
+
var conversationId = cleanText((_a = entry === null || entry === void 0 ? void 0 : entry.id_conversation) !== null && _a !== void 0 ? _a : entry === null || entry === void 0 ? void 0 : entry.idConversation, 240);
|
|
89
|
+
if (conversationId) {
|
|
90
|
+
return conversationId;
|
|
91
|
+
}
|
|
92
|
+
return cleanText((_b = entry === null || entry === void 0 ? void 0 : entry.id_request) !== null && _b !== void 0 ? _b : entry === null || entry === void 0 ? void 0 : entry.idRequest, 240);
|
|
93
|
+
}
|
|
94
|
+
function normalizeOpenAIUsageRowsForCosting(rows) {
|
|
95
|
+
if (rows === void 0) { rows = []; }
|
|
96
|
+
if (!Array.isArray(rows) || !rows.length) {
|
|
97
|
+
return [];
|
|
98
|
+
}
|
|
99
|
+
var sortedRows = rows
|
|
100
|
+
.map(function (row, index) { return (__assign(__assign({}, row), { _sortIndex: index })); })
|
|
101
|
+
.sort(function (a, b) {
|
|
102
|
+
var _a, _b, _c, _d, _e, _f;
|
|
103
|
+
var timeA = ((_a = cleanUsageDate(a.timestamp)) === null || _a === void 0 ? void 0 : _a.getTime()) || 0;
|
|
104
|
+
var timeB = ((_b = cleanUsageDate(b.timestamp)) === null || _b === void 0 ? void 0 : _b.getTime()) || 0;
|
|
105
|
+
if (timeA !== timeB) {
|
|
106
|
+
return timeA - timeB;
|
|
107
|
+
}
|
|
108
|
+
var requestCompare = cleanText((_c = a.id_request) !== null && _c !== void 0 ? _c : a.idRequest, 240)
|
|
109
|
+
.localeCompare(cleanText((_d = b.id_request) !== null && _d !== void 0 ? _d : b.idRequest, 240));
|
|
110
|
+
if (requestCompare) {
|
|
111
|
+
return requestCompare;
|
|
112
|
+
}
|
|
113
|
+
var conversationCompare = cleanText((_e = a.id_conversation) !== null && _e !== void 0 ? _e : a.idConversation, 240)
|
|
114
|
+
.localeCompare(cleanText((_f = b.id_conversation) !== null && _f !== void 0 ? _f : b.idConversation, 240));
|
|
115
|
+
if (conversationCompare) {
|
|
116
|
+
return conversationCompare;
|
|
117
|
+
}
|
|
118
|
+
return cleanUsageNumber(a._sortIndex) - cleanUsageNumber(b._sortIndex);
|
|
119
|
+
});
|
|
120
|
+
var previousByThread = new Map();
|
|
121
|
+
return sortedRows.map(function (row) {
|
|
122
|
+
var _a, _b, _c, _d, _e, _f;
|
|
123
|
+
var inputTokens = cleanUsageNumber((_a = row.input_tokens) !== null && _a !== void 0 ? _a : row.inputTokens);
|
|
124
|
+
var cachedInputTokens = cleanUsageNumber((_b = row.cached_input_tokens) !== null && _b !== void 0 ? _b : row.cachedInputTokens);
|
|
125
|
+
var outputTokens = cleanUsageNumber((_c = row.output_tokens) !== null && _c !== void 0 ? _c : row.outputTokens);
|
|
126
|
+
var totalTokens = cleanUsageNumber((_e = (_d = row.total_tokens) !== null && _d !== void 0 ? _d : row.totalTokens) !== null && _e !== void 0 ? _e : (inputTokens + outputTokens));
|
|
127
|
+
var estimatedUsd = cleanUsageNumber((_f = row.cost_estimate) !== null && _f !== void 0 ? _f : row.estimatedUsd);
|
|
128
|
+
var threadKey = isCumulativeCodexUsageEntry(row) ? resolveOpenAIUsageThreadKey(row) : '';
|
|
129
|
+
var normalizedInputTokens = inputTokens;
|
|
130
|
+
var normalizedCachedInputTokens = cachedInputTokens;
|
|
131
|
+
var normalizedOutputTokens = outputTokens;
|
|
132
|
+
var normalizedTotalTokens = totalTokens;
|
|
133
|
+
var normalizedEstimatedUsd = estimatedUsd;
|
|
134
|
+
if (threadKey) {
|
|
135
|
+
var previous = previousByThread.get(threadKey);
|
|
136
|
+
if (previous
|
|
137
|
+
&& inputTokens >= previous.inputTokens
|
|
138
|
+
&& cachedInputTokens >= previous.cachedInputTokens
|
|
139
|
+
&& outputTokens >= previous.outputTokens
|
|
140
|
+
&& totalTokens >= previous.totalTokens
|
|
141
|
+
&& estimatedUsd >= previous.estimatedUsd) {
|
|
142
|
+
normalizedInputTokens = Math.max(0, inputTokens - previous.inputTokens);
|
|
143
|
+
normalizedCachedInputTokens = Math.max(0, cachedInputTokens - previous.cachedInputTokens);
|
|
144
|
+
normalizedOutputTokens = Math.max(0, outputTokens - previous.outputTokens);
|
|
145
|
+
normalizedTotalTokens = Math.max(0, totalTokens - previous.totalTokens);
|
|
146
|
+
normalizedEstimatedUsd = Math.max(0, estimatedUsd - previous.estimatedUsd);
|
|
147
|
+
}
|
|
148
|
+
previousByThread.set(threadKey, {
|
|
149
|
+
inputTokens: inputTokens,
|
|
150
|
+
cachedInputTokens: cachedInputTokens,
|
|
151
|
+
outputTokens: outputTokens,
|
|
152
|
+
totalTokens: totalTokens,
|
|
153
|
+
estimatedUsd: estimatedUsd
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
var resolvedTotalTokens = normalizedTotalTokens || (normalizedInputTokens + normalizedOutputTokens);
|
|
157
|
+
var resolvedEstimatedUsd = Number(normalizedEstimatedUsd.toFixed(6));
|
|
158
|
+
return __assign(__assign({}, row), { input_tokens: normalizedInputTokens, inputTokens: normalizedInputTokens, cached_input_tokens: normalizedCachedInputTokens, cachedInputTokens: normalizedCachedInputTokens, output_tokens: normalizedOutputTokens, outputTokens: normalizedOutputTokens, total_tokens: resolvedTotalTokens, totalTokens: resolvedTotalTokens, cost_estimate: resolvedEstimatedUsd, estimatedUsd: resolvedEstimatedUsd });
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
function cleanList(values, limit, max) {
|
|
162
|
+
var e_1, _a;
|
|
163
|
+
if (limit === void 0) { limit = 20; }
|
|
164
|
+
if (max === void 0) { max = 500; }
|
|
165
|
+
if (!Array.isArray(values)) {
|
|
166
|
+
return [];
|
|
167
|
+
}
|
|
168
|
+
var result = [];
|
|
169
|
+
try {
|
|
170
|
+
for (var values_1 = __values(values), values_1_1 = values_1.next(); !values_1_1.done; values_1_1 = values_1.next()) {
|
|
171
|
+
var value = values_1_1.value;
|
|
172
|
+
var normalized = cleanText(value, max);
|
|
173
|
+
if (normalized && !result.includes(normalized)) {
|
|
174
|
+
result.push(normalized);
|
|
175
|
+
}
|
|
176
|
+
if (result.length >= limit) {
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
182
|
+
finally {
|
|
183
|
+
try {
|
|
184
|
+
if (values_1_1 && !values_1_1.done && (_a = values_1.return)) _a.call(values_1);
|
|
185
|
+
}
|
|
186
|
+
finally { if (e_1) throw e_1.error; }
|
|
187
|
+
}
|
|
188
|
+
return result;
|
|
189
|
+
}
|
|
190
|
+
function normalizeCheckStatus(value) {
|
|
191
|
+
var normalized = cleanText(value, 40).toLowerCase().replace(/[_\s-]+/g, '_');
|
|
192
|
+
if (normalized === 'passed' || normalized === 'ok' || normalized === 'ready') {
|
|
193
|
+
return 'pass';
|
|
194
|
+
}
|
|
195
|
+
if (normalized === 'failed' || normalized === 'error' || normalized === 'fail') {
|
|
196
|
+
return 'fail';
|
|
197
|
+
}
|
|
198
|
+
if (normalized === 'blocked' || normalized === 'dependency_blocked') {
|
|
199
|
+
return 'blocked';
|
|
200
|
+
}
|
|
201
|
+
if (normalized === 'warning') {
|
|
202
|
+
return 'warn';
|
|
203
|
+
}
|
|
204
|
+
if (normalized === 'skipped' || normalized === 'not_applicable') {
|
|
205
|
+
return 'skipped';
|
|
206
|
+
}
|
|
207
|
+
return normalized === 'pass' || normalized === 'warn' ? normalized : 'unknown';
|
|
208
|
+
}
|
|
209
|
+
function normalizeCompileStatus(value) {
|
|
210
|
+
var normalized = cleanText(value, 40).toLowerCase().replace(/[_\s-]+/g, '_');
|
|
211
|
+
if (normalized === 'passed' || normalized === 'ok') {
|
|
212
|
+
return 'pass';
|
|
213
|
+
}
|
|
214
|
+
if (normalized === 'failed' || normalized === 'error') {
|
|
215
|
+
return 'fail';
|
|
216
|
+
}
|
|
217
|
+
if (normalized === 'blocked') {
|
|
218
|
+
return 'blocked';
|
|
219
|
+
}
|
|
220
|
+
if (normalized === 'stale' || normalized === 'stale_evidence') {
|
|
221
|
+
return 'stale';
|
|
222
|
+
}
|
|
223
|
+
if (normalized === 'skipped' || normalized === 'not_applicable') {
|
|
224
|
+
return 'skipped';
|
|
225
|
+
}
|
|
226
|
+
return normalized === 'pass' || normalized === 'fail' ? normalized : 'unknown';
|
|
227
|
+
}
|
|
228
|
+
function makeGate(key, label, status, reason, evidenceRefs, now, metadata) {
|
|
229
|
+
if (evidenceRefs === void 0) { evidenceRefs = []; }
|
|
230
|
+
return __assign({ key: key, label: label, status: status, reason: cleanText(reason, 1400), evidenceRefs: cleanList(evidenceRefs, 20, 500), recordedAt: isoNow(now) }, (metadata ? { metadata: metadata } : {}));
|
|
231
|
+
}
|
|
232
|
+
function failedOrBlocked(status) {
|
|
233
|
+
return status === 'fail' || status === 'blocked';
|
|
234
|
+
}
|
|
235
|
+
function passed(status) {
|
|
236
|
+
return status === 'pass';
|
|
237
|
+
}
|
|
238
|
+
function normalizeInfraChecks(values) {
|
|
239
|
+
return (Array.isArray(values) ? values : []).map(function (entry) { return (__assign(__assign({}, entry), { name: cleanText(entry === null || entry === void 0 ? void 0 : entry.name, 120) || 'infra_check', status: normalizeCheckStatus(entry === null || entry === void 0 ? void 0 : entry.status), message: cleanText(entry === null || entry === void 0 ? void 0 : entry.message, 1000), path: cleanText(entry === null || entry === void 0 ? void 0 : entry.path, 500) })); });
|
|
240
|
+
}
|
|
241
|
+
function normalizeRouteProbes(values) {
|
|
242
|
+
return (Array.isArray(values) ? values : []).map(function (entry) { return (__assign(__assign({}, entry), { route: cleanText(entry === null || entry === void 0 ? void 0 : entry.route, 500) || '/', status: normalizeCheckStatus(entry === null || entry === void 0 ? void 0 : entry.status), screenshot: cleanText(entry === null || entry === void 0 ? void 0 : entry.screenshot, 500), caption: cleanText(entry === null || entry === void 0 ? void 0 : entry.caption, 1000), message: cleanText(entry === null || entry === void 0 ? void 0 : entry.message, 1000), consoleErrors: cleanList(entry === null || entry === void 0 ? void 0 : entry.consoleErrors, 30, 500), networkErrors: cleanList(entry === null || entry === void 0 ? void 0 : entry.networkErrors, 30, 500) })); });
|
|
243
|
+
}
|
|
244
|
+
function normalizeBusinessAssertions(values) {
|
|
245
|
+
return (Array.isArray(values) ? values : []).map(function (entry) { return (__assign(__assign({}, entry), { assertion: cleanText(entry === null || entry === void 0 ? void 0 : entry.assertion, 1000) || 'business assertion', status: normalizeCheckStatus(entry === null || entry === void 0 ? void 0 : entry.status), workflow: cleanText(entry === null || entry === void 0 ? void 0 : entry.workflow, 400), route: cleanText(entry === null || entry === void 0 ? void 0 : entry.route, 500), action: cleanText(entry === null || entry === void 0 ? void 0 : entry.action, 500), expected: cleanText(entry === null || entry === void 0 ? void 0 : entry.expected, 1000), observed: cleanText(entry === null || entry === void 0 ? void 0 : entry.observed, 1000), dataProof: cleanText(entry === null || entry === void 0 ? void 0 : entry.dataProof, 1400), artifactPaths: cleanList(entry === null || entry === void 0 ? void 0 : entry.artifactPaths, 30, 500), message: cleanText(entry === null || entry === void 0 ? void 0 : entry.message, 1000) })); });
|
|
246
|
+
}
|
|
247
|
+
function collectBusinessAssertionArtifactPaths(assertions) {
|
|
248
|
+
var e_2, _a, e_3, _b;
|
|
249
|
+
var paths = [];
|
|
250
|
+
try {
|
|
251
|
+
for (var assertions_1 = __values(assertions), assertions_1_1 = assertions_1.next(); !assertions_1_1.done; assertions_1_1 = assertions_1.next()) {
|
|
252
|
+
var assertion = assertions_1_1.value;
|
|
253
|
+
try {
|
|
254
|
+
for (var _c = (e_3 = void 0, __values(assertion.artifactPaths || [])), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
255
|
+
var artifactPath = _d.value;
|
|
256
|
+
if (artifactPath && !paths.includes(artifactPath)) {
|
|
257
|
+
paths.push(artifactPath);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
262
|
+
finally {
|
|
263
|
+
try {
|
|
264
|
+
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
265
|
+
}
|
|
266
|
+
finally { if (e_3) throw e_3.error; }
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
271
|
+
finally {
|
|
272
|
+
try {
|
|
273
|
+
if (assertions_1_1 && !assertions_1_1.done && (_a = assertions_1.return)) _a.call(assertions_1);
|
|
274
|
+
}
|
|
275
|
+
finally { if (e_2) throw e_2.error; }
|
|
276
|
+
}
|
|
277
|
+
return paths;
|
|
278
|
+
}
|
|
279
|
+
function buildAIQaRun(input) {
|
|
280
|
+
if (input === void 0) { input = {}; }
|
|
281
|
+
var now = isoNow(input.now);
|
|
282
|
+
var infraChecks = normalizeInfraChecks(input.infraChecks);
|
|
283
|
+
var compile = input.compile
|
|
284
|
+
? __assign(__assign({}, input.compile), { status: normalizeCompileStatus(input.compile.status), command: cleanText(input.compile.command, 500), artifactPath: cleanText(input.compile.artifactPath, 500), message: cleanText(input.compile.message, 1000) }) : undefined;
|
|
285
|
+
var routeProbes = normalizeRouteProbes(input.routeProbes);
|
|
286
|
+
var businessAssertions = normalizeBusinessAssertions(input.businessAssertions);
|
|
287
|
+
var artifacts = Array.isArray(input.artifacts) ? input.artifacts : [];
|
|
288
|
+
var gateResults = [];
|
|
289
|
+
var failedInfra = infraChecks.filter(function (check) { return failedOrBlocked(check.status); });
|
|
290
|
+
if (failedInfra.length) {
|
|
291
|
+
gateResults.push(makeGate('qa_infra', 'QA infrastructure', 'blocked', "QA infrastructure failed before model/business validation: ".concat(failedInfra.map(function (check) { return "".concat(check.name, ": ").concat(check.message || check.status); }).join('; ')), failedInfra.map(function (check) { return check.path || ''; }).filter(Boolean), now, { failed_checks: failedInfra.map(function (check) { return check.name; }) }));
|
|
292
|
+
return { outcome: 'infra_failed', infraChecks: infraChecks, compile: compile, routeProbes: routeProbes, businessAssertions: businessAssertions, artifacts: artifacts, gateResults: gateResults, updatedAt: now };
|
|
293
|
+
}
|
|
294
|
+
if (infraChecks.length) {
|
|
295
|
+
gateResults.push(makeGate('qa_infra', 'QA infrastructure', 'pass', 'QA infrastructure preflight checks passed.', [], now));
|
|
296
|
+
}
|
|
297
|
+
if (compile && (failedOrBlocked(compile.status) || compile.status === 'stale' || compile.staleEvidence === true)) {
|
|
298
|
+
gateResults.push(makeGate('qa_compile', 'Compile/build', 'fail', compile.status === 'stale' || compile.staleEvidence === true
|
|
299
|
+
? 'Compile/build evidence is stale and cannot be used for acceptance.'
|
|
300
|
+
: (compile.message || 'Compile/build failed before browser QA.'), compile.artifactPath ? [compile.artifactPath] : [], now, { command: compile.command || '' }));
|
|
301
|
+
return { outcome: 'compile_failed', infraChecks: infraChecks, compile: compile, routeProbes: routeProbes, businessAssertions: businessAssertions, artifacts: artifacts, gateResults: gateResults, updatedAt: now };
|
|
302
|
+
}
|
|
303
|
+
if (compile && passed(compile.status)) {
|
|
304
|
+
gateResults.push(makeGate('qa_compile', 'Compile/build', 'pass', 'Compile/build evidence passed.', compile.artifactPath ? [compile.artifactPath] : [], now));
|
|
305
|
+
}
|
|
306
|
+
var failedRouteProbes = routeProbes.filter(function (probe) { return failedOrBlocked(probe.status) || probe.shellOnly === true; });
|
|
307
|
+
if (failedRouteProbes.length) {
|
|
308
|
+
gateResults.push(makeGate('qa_route_probe', 'Browser route probe', 'fail', "Browser route probe failed or showed shell-only UI: ".concat(failedRouteProbes.map(function (probe) { return "".concat(probe.route, ": ").concat(probe.message || probe.caption || probe.status); }).join('; ')), failedRouteProbes.map(function (probe) { return probe.screenshot || ''; }).filter(Boolean), now));
|
|
309
|
+
return { outcome: 'route_failed', infraChecks: infraChecks, compile: compile, routeProbes: routeProbes, businessAssertions: businessAssertions, artifacts: artifacts, gateResults: gateResults, updatedAt: now };
|
|
310
|
+
}
|
|
311
|
+
if (routeProbes.some(function (probe) { return passed(probe.status); })) {
|
|
312
|
+
gateResults.push(makeGate('qa_route_probe', 'Browser route probe', 'pass', 'Browser route reached authenticated application content. This is not business acceptance by itself.', routeProbes.map(function (probe) { return probe.screenshot || ''; }).filter(Boolean), now));
|
|
313
|
+
}
|
|
314
|
+
var failedBusinessAssertions = businessAssertions.filter(function (assertion) { return failedOrBlocked(assertion.status); });
|
|
315
|
+
if (failedBusinessAssertions.length) {
|
|
316
|
+
gateResults.push(makeGate('qa_business_assertion', 'Business assertion', 'fail', "Issue-specific workflow assertion failed: ".concat(failedBusinessAssertions.map(function (assertion) { return assertion.message || assertion.observed || assertion.assertion; }).join('; ')), collectBusinessAssertionArtifactPaths(failedBusinessAssertions), now));
|
|
317
|
+
return { outcome: 'business_assertion_failed', infraChecks: infraChecks, compile: compile, routeProbes: routeProbes, businessAssertions: businessAssertions, artifacts: artifacts, gateResults: gateResults, updatedAt: now };
|
|
318
|
+
}
|
|
319
|
+
var passedBusinessAssertions = businessAssertions.filter(function (assertion) { return passed(assertion.status); });
|
|
320
|
+
if (passedBusinessAssertions.length) {
|
|
321
|
+
gateResults.push(makeGate('qa_business_assertion', 'Business assertion', 'pass', 'At least one issue-specific workflow/data assertion passed.', collectBusinessAssertionArtifactPaths(passedBusinessAssertions), now, { passed_assertions: passedBusinessAssertions.map(function (assertion) { return assertion.assertion; }) }));
|
|
322
|
+
return { outcome: 'business_assertion_passed', infraChecks: infraChecks, compile: compile, routeProbes: routeProbes, businessAssertions: businessAssertions, artifacts: artifacts, gateResults: gateResults, updatedAt: now };
|
|
323
|
+
}
|
|
324
|
+
if (routeProbes.some(function (probe) { return passed(probe.status); })) {
|
|
325
|
+
gateResults.push(makeGate('qa_business_assertion', 'Business assertion', 'blocked', 'Browser route loaded, but no issue-specific business assertion passed. Route-only proof cannot accept the run.', [], now));
|
|
326
|
+
return { outcome: 'route_only_pass', infraChecks: infraChecks, compile: compile, routeProbes: routeProbes, businessAssertions: businessAssertions, artifacts: artifacts, gateResults: gateResults, updatedAt: now };
|
|
327
|
+
}
|
|
328
|
+
gateResults.push(makeGate('qa_business_assertion', 'Business assertion', 'blocked', 'No issue-specific QA assertion was recorded.', [], now));
|
|
329
|
+
return { outcome: 'incomplete', infraChecks: infraChecks, compile: compile, routeProbes: routeProbes, businessAssertions: businessAssertions, artifacts: artifacts, gateResults: gateResults, updatedAt: now };
|
|
330
|
+
}
|
|
331
|
+
function normalizeQaRun(input) {
|
|
332
|
+
if (!input) {
|
|
333
|
+
return undefined;
|
|
334
|
+
}
|
|
335
|
+
if (input.outcome && Array.isArray(input.gateResults)) {
|
|
336
|
+
return input;
|
|
337
|
+
}
|
|
338
|
+
return buildAIQaRun(input);
|
|
339
|
+
}
|
|
340
|
+
function statusLooksFailed(value) {
|
|
341
|
+
var normalized = cleanText(value, 120).toLowerCase();
|
|
342
|
+
return !!normalized && /(fail|failed|error|blocked|missing|empty|stale|skipped|not ready|not_ready|could not|cannot)/i.test(normalized);
|
|
343
|
+
}
|
|
344
|
+
function statusLooksPassed(value) {
|
|
345
|
+
var normalized = cleanText(value, 120).toLowerCase();
|
|
346
|
+
return !!normalized && /(pass|passed|success|complete|completed|ready|published|deployed|live|merged)/i.test(normalized);
|
|
347
|
+
}
|
|
348
|
+
function addGateOnce(gates, gate) {
|
|
349
|
+
if (gates.some(function (entry) { return entry.key === gate.key && entry.status === gate.status && entry.reason === gate.reason; })) {
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
gates.push(gate);
|
|
353
|
+
}
|
|
354
|
+
function classifyAIRunOutcome(input) {
|
|
355
|
+
var e_4, _a;
|
|
356
|
+
if (input === void 0) { input = {}; }
|
|
357
|
+
var now = isoNow(input.now);
|
|
358
|
+
var gates = Array.isArray(input.gates) ? __spreadArray([], __read(input.gates), false) : [];
|
|
359
|
+
var warnings = [];
|
|
360
|
+
var qa = normalizeQaRun(input.qa);
|
|
361
|
+
if (qa) {
|
|
362
|
+
try {
|
|
363
|
+
for (var _b = __values(qa.gateResults), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
364
|
+
var gate = _c.value;
|
|
365
|
+
addGateOnce(gates, gate);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
369
|
+
finally {
|
|
370
|
+
try {
|
|
371
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
372
|
+
}
|
|
373
|
+
finally { if (e_4) throw e_4.error; }
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
if (input.manualHandoff === true) {
|
|
377
|
+
return {
|
|
378
|
+
outcome: 'manual_handoff',
|
|
379
|
+
reason: 'Run requires manual handoff.',
|
|
380
|
+
nextAction: 'Ask a human operator to resolve the blocked run.',
|
|
381
|
+
gates: gates,
|
|
382
|
+
warnings: warnings,
|
|
383
|
+
recordedAt: now
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
if (input.stopped === true || /stop|stopped|cancel|cancelled|paused/i.test("".concat(input.status || '', " ").concat(input.phase || ''))) {
|
|
387
|
+
return {
|
|
388
|
+
outcome: 'stopped',
|
|
389
|
+
reason: 'Run was stopped before accepted evidence was recorded.',
|
|
390
|
+
nextAction: 'Resume or restart only if the request is still active.',
|
|
391
|
+
gates: gates,
|
|
392
|
+
warnings: warnings,
|
|
393
|
+
recordedAt: now
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
if (input.rejected === true) {
|
|
397
|
+
return {
|
|
398
|
+
outcome: 'rejected',
|
|
399
|
+
reason: 'Run was explicitly rejected.',
|
|
400
|
+
nextAction: 'Start a repair run from the failing evidence.',
|
|
401
|
+
gates: gates,
|
|
402
|
+
warnings: warnings,
|
|
403
|
+
recordedAt: now
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
var blockedHotfixCommitGate = gates.find(function (gate) { return gate.key === 'hotfix_commit_proof' && (gate.status === 'blocked' || gate.status === 'fail'); });
|
|
407
|
+
if (blockedHotfixCommitGate) {
|
|
408
|
+
return {
|
|
409
|
+
outcome: 'release_blocked',
|
|
410
|
+
reason: "Hotfix cannot be treated as durable until GitHub commit proof passes: ".concat(blockedHotfixCommitGate.reason),
|
|
411
|
+
nextAction: 'Commit and push the hotfix to GitHub, record sourceCommitSha/githubCommitUrl/gitCommitStatus/gitPushStatus, then rerun the smallest release gate.',
|
|
412
|
+
gates: gates,
|
|
413
|
+
warnings: warnings,
|
|
414
|
+
recordedAt: now
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
var blockedNoBlindLoopGate = gates.find(function (gate) { return gate.key === 'manager_no_blind_loop_policy' && gate.status === 'blocked'; });
|
|
418
|
+
if (blockedNoBlindLoopGate) {
|
|
419
|
+
return {
|
|
420
|
+
outcome: 'manual_handoff',
|
|
421
|
+
reason: "Manager parked the run to avoid a blind loop: ".concat(blockedNoBlindLoopGate.reason),
|
|
422
|
+
nextAction: 'Collect new material evidence or approve the specific recovery decision before any more model/code repair.',
|
|
423
|
+
gates: gates,
|
|
424
|
+
warnings: warnings,
|
|
425
|
+
recordedAt: now
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
var blockedSupportDiagnosisBeforeRepairGate = gates.find(function (gate) { return gate.key === 'support_diagnosis_before_repair' && gate.status === 'blocked'; });
|
|
429
|
+
if (blockedSupportDiagnosisBeforeRepairGate) {
|
|
430
|
+
return {
|
|
431
|
+
outcome: 'manual_handoff',
|
|
432
|
+
reason: "Support repair is parked until root-cause diagnosis validates: ".concat(blockedSupportDiagnosisBeforeRepairGate.reason),
|
|
433
|
+
nextAction: 'Run read-only support diagnosis, record support_diagnosis_gate with owner_files and before/action/after proof, then retry only the owner-scoped repair.',
|
|
434
|
+
gates: gates,
|
|
435
|
+
warnings: warnings,
|
|
436
|
+
recordedAt: now
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
var blockedSupportOwnerFileScopeGate = gates.find(function (gate) { return gate.key === 'support_owner_file_scope' && gate.status === 'blocked'; });
|
|
440
|
+
if (blockedSupportOwnerFileScopeGate) {
|
|
441
|
+
return {
|
|
442
|
+
outcome: 'manual_handoff',
|
|
443
|
+
reason: "Support repair exceeded the diagnosed owner-file scope: ".concat(blockedSupportOwnerFileScopeGate.reason),
|
|
444
|
+
nextAction: 'Revise the SupportDiagnosisGate with evidence for each new owner file, update failing_path/proof_plan, then run only the bounded owner-scoped repair.',
|
|
445
|
+
gates: gates,
|
|
446
|
+
warnings: warnings,
|
|
447
|
+
recordedAt: now
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
if ((qa === null || qa === void 0 ? void 0 : qa.outcome) === 'infra_failed') {
|
|
451
|
+
return {
|
|
452
|
+
outcome: 'qa_infra_failed',
|
|
453
|
+
reason: 'QA infrastructure failed before product validation.',
|
|
454
|
+
nextAction: 'Repair QA harness dependencies, ports, browser, Mongo, or startup before another model repair loop.',
|
|
455
|
+
gates: gates,
|
|
456
|
+
warnings: warnings,
|
|
457
|
+
recordedAt: now
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
if ((qa === null || qa === void 0 ? void 0 : qa.outcome) === 'compile_failed') {
|
|
461
|
+
return {
|
|
462
|
+
outcome: 'build_failed',
|
|
463
|
+
reason: 'Compile/build evidence failed or was stale.',
|
|
464
|
+
nextAction: 'Repair compile/build first, then rerun QA from the same failed step.',
|
|
465
|
+
gates: gates,
|
|
466
|
+
warnings: warnings,
|
|
467
|
+
recordedAt: now
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
if ((qa === null || qa === void 0 ? void 0 : qa.outcome) === 'route_failed') {
|
|
471
|
+
return {
|
|
472
|
+
outcome: 'qa_incomplete',
|
|
473
|
+
reason: 'Browser route probe failed before business proof.',
|
|
474
|
+
nextAction: 'Repair route/auth/startup issue and rerun the same browser route probe.',
|
|
475
|
+
gates: gates,
|
|
476
|
+
warnings: warnings,
|
|
477
|
+
recordedAt: now
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
var blockedAICoderJourneyContractGate = gates.find(function (gate) { return gate.key === 'aicoder_journey_contract' && (gate.status === 'blocked' || gate.status === 'fail'); });
|
|
481
|
+
if (blockedAICoderJourneyContractGate) {
|
|
482
|
+
var claimedSuccess = input.explicitAccepted === true || input.scorecardPassed === true || statusLooksPassed(input.scorecardStatus) || statusLooksPassed("".concat(input.status || '', " ").concat(input.phase || ''));
|
|
483
|
+
return {
|
|
484
|
+
outcome: claimedSuccess ? 'false_pass' : 'qa_incomplete',
|
|
485
|
+
reason: claimedSuccess
|
|
486
|
+
? "AICoder run claimed success without a valid Journey Contract: ".concat(blockedAICoderJourneyContractGate.reason)
|
|
487
|
+
: "AICoder workflow is blocked until the Journey Contract validates: ".concat(blockedAICoderJourneyContractGate.reason),
|
|
488
|
+
nextAction: 'Generate or repair docs/APP_JOURNEY_CONTRACT.md, validate first/next/last workflow/data story/QA assertions, then rerun workflow build and workflow QA.',
|
|
489
|
+
gates: gates,
|
|
490
|
+
warnings: warnings,
|
|
491
|
+
recordedAt: now
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
var blockedSupportNextActionContractGate = gates.find(function (gate) { return gate.key === 'support_next_action_contract' && gate.status === 'blocked'; });
|
|
495
|
+
if (blockedSupportNextActionContractGate
|
|
496
|
+
&& (qa === null || qa === void 0 ? void 0 : qa.outcome) !== 'business_assertion_passed'
|
|
497
|
+
&& input.scorecardPassed !== true
|
|
498
|
+
&& !statusLooksPassed(input.scorecardStatus)) {
|
|
499
|
+
return {
|
|
500
|
+
outcome: 'manual_handoff',
|
|
501
|
+
reason: "Support manager cannot safely continue without a valid next-action contract: ".concat(blockedSupportNextActionContractGate.reason),
|
|
502
|
+
nextAction: 'Record one validated next-action contract with safeToAutoRun, canRunWithoutCodexMonitor, codexFallbackRequired, preconditions, stop conditions, and success evidence before another autonomous recovery.',
|
|
503
|
+
gates: gates,
|
|
504
|
+
warnings: warnings,
|
|
505
|
+
recordedAt: now
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
var blockedSupportIssueClassProbePlanGate = gates.find(function (gate) { return gate.key === 'support_issue_class_probe_plan' && (gate.status === 'blocked' || gate.status === 'fail'); });
|
|
509
|
+
if (input.source === 'support_ticket' && blockedSupportIssueClassProbePlanGate) {
|
|
510
|
+
var claimedSuccess = input.explicitAccepted === true
|
|
511
|
+
|| input.scorecardPassed === true
|
|
512
|
+
|| statusLooksPassed(input.scorecardStatus)
|
|
513
|
+
|| statusLooksPassed("".concat(input.status || '', " ").concat(input.phase || ''));
|
|
514
|
+
return {
|
|
515
|
+
outcome: claimedSuccess ? 'false_pass' : 'qa_incomplete',
|
|
516
|
+
reason: claimedSuccess
|
|
517
|
+
? "Support run claimed success without a valid issue-class probe plan: ".concat(blockedSupportIssueClassProbePlanGate.reason)
|
|
518
|
+
: "Support business proof is blocked until the issue-class probe plan validates: ".concat(blockedSupportIssueClassProbePlanGate.reason),
|
|
519
|
+
nextAction: 'Generate or repair the Support IssueClassProbePlan from the diagnosis proof_plan, then rerun issue-specific business proof QA.',
|
|
520
|
+
gates: gates,
|
|
521
|
+
warnings: warnings,
|
|
522
|
+
recordedAt: now
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
var blockedAssistantAnswerActionabilityGate = gates.find(function (gate) { return gate.key === 'assistant_answer_actionability' && (gate.status === 'blocked' || gate.status === 'fail'); });
|
|
526
|
+
if (input.source === 'ai_assistant' && blockedAssistantAnswerActionabilityGate) {
|
|
527
|
+
var claimedSuccess = input.explicitAccepted === true
|
|
528
|
+
|| statusLooksPassed("".concat(input.status || '', " ").concat(input.phase || ''));
|
|
529
|
+
return {
|
|
530
|
+
outcome: claimedSuccess ? 'false_pass' : 'qa_incomplete',
|
|
531
|
+
reason: claimedSuccess
|
|
532
|
+
? "Assistant answer was marked accepted without a valid actionability contract: ".concat(blockedAssistantAnswerActionabilityGate.reason)
|
|
533
|
+
: "Assistant answer is blocked until actionability evidence validates: ".concat(blockedAssistantAnswerActionabilityGate.reason),
|
|
534
|
+
nextAction: 'Record verified query/date/permission/citation/confidence evidence and one assistant actionability contract before answering or drafting customer-facing text.',
|
|
535
|
+
gates: gates,
|
|
536
|
+
warnings: warnings,
|
|
537
|
+
recordedAt: now
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
if ((qa === null || qa === void 0 ? void 0 : qa.outcome) === 'route_only_pass' || (qa === null || qa === void 0 ? void 0 : qa.outcome) === 'incomplete') {
|
|
541
|
+
return {
|
|
542
|
+
outcome: input.scorecardPassed === true ? 'false_pass' : 'qa_incomplete',
|
|
543
|
+
reason: input.scorecardPassed === true
|
|
544
|
+
? 'Scorecard or workflow status passed without issue-specific business assertion proof.'
|
|
545
|
+
: 'QA has not recorded issue-specific business assertion proof.',
|
|
546
|
+
nextAction: 'Add before/action/after workflow proof with screenshot/data assertions before acceptance.',
|
|
547
|
+
gates: gates,
|
|
548
|
+
warnings: warnings,
|
|
549
|
+
recordedAt: now
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
if ((qa === null || qa === void 0 ? void 0 : qa.outcome) === 'business_assertion_failed') {
|
|
553
|
+
return {
|
|
554
|
+
outcome: input.terminal === true ? 'rejected' : 'qa_incomplete',
|
|
555
|
+
reason: 'Issue-specific business assertion failed.',
|
|
556
|
+
nextAction: 'Repair the product/data defect and rerun the failing assertion.',
|
|
557
|
+
gates: gates,
|
|
558
|
+
warnings: warnings,
|
|
559
|
+
recordedAt: now
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
var hasBusinessPass = (qa === null || qa === void 0 ? void 0 : qa.outcome) === 'business_assertion_passed';
|
|
563
|
+
var scorecardPassed = input.scorecardPassed === true || statusLooksPassed(input.scorecardStatus);
|
|
564
|
+
var releaseBlockers = [];
|
|
565
|
+
if (statusLooksFailed(input.deployStatus)) {
|
|
566
|
+
releaseBlockers.push("deploy=".concat(cleanText(input.deployStatus, 120)));
|
|
567
|
+
}
|
|
568
|
+
if (statusLooksFailed(input.publishStatus)) {
|
|
569
|
+
releaseBlockers.push("publish=".concat(cleanText(input.publishStatus, 120)));
|
|
570
|
+
}
|
|
571
|
+
if (statusLooksFailed(input.sampleDataStatus)) {
|
|
572
|
+
releaseBlockers.push("sample_data=".concat(cleanText(input.sampleDataStatus, 120)));
|
|
573
|
+
}
|
|
574
|
+
if (releaseBlockers.length && (scorecardPassed || hasBusinessPass)) {
|
|
575
|
+
addGateOnce(gates, makeGate('release', 'Release/deploy', 'fail', "Final acceptance is blocked after QA/scorecard because release gates failed: ".concat(releaseBlockers.join(', '), "."), [], now));
|
|
576
|
+
return {
|
|
577
|
+
outcome: 'release_blocked',
|
|
578
|
+
reason: "Release gates failed after QA/scorecard: ".concat(releaseBlockers.join(', '), "."),
|
|
579
|
+
nextAction: 'Repair deploy/publish/sample-data coverage before marking the run accepted.',
|
|
580
|
+
gates: gates,
|
|
581
|
+
warnings: warnings,
|
|
582
|
+
recordedAt: now
|
|
583
|
+
};
|
|
584
|
+
}
|
|
585
|
+
var blockedAICoderNextActionContractGate = gates.find(function (gate) { return gate.key === 'aicoder_next_action_contract' && (gate.status === 'blocked' || gate.status === 'fail'); });
|
|
586
|
+
if (input.source === 'aicoder_app' && blockedAICoderNextActionContractGate) {
|
|
587
|
+
var claimedSuccess = input.explicitAccepted === true
|
|
588
|
+
|| input.scorecardPassed === true
|
|
589
|
+
|| statusLooksPassed(input.scorecardStatus)
|
|
590
|
+
|| statusLooksPassed("".concat(input.status || '', " ").concat(input.phase || ''));
|
|
591
|
+
return {
|
|
592
|
+
outcome: claimedSuccess ? 'false_pass' : 'manual_handoff',
|
|
593
|
+
reason: claimedSuccess
|
|
594
|
+
? "AICoder run claimed success without a manager-safe next-action contract: ".concat(blockedAICoderNextActionContractGate.reason)
|
|
595
|
+
: "AICoder manager cannot safely continue without a manager-safe next-action contract: ".concat(blockedAICoderNextActionContractGate.reason),
|
|
596
|
+
nextAction: 'Record one validated AICoder next-action contract with safeToAutoRun, canRunWithoutCodexMonitor, codexFallbackRequired, stop conditions, and success evidence before another autonomous loop.',
|
|
597
|
+
gates: gates,
|
|
598
|
+
warnings: warnings,
|
|
599
|
+
recordedAt: now
|
|
600
|
+
};
|
|
601
|
+
}
|
|
602
|
+
if (scorecardPassed && !hasBusinessPass) {
|
|
603
|
+
warnings.push('scorecard_pass_without_business_assertion');
|
|
604
|
+
addGateOnce(gates, makeGate('business_assertion_required', 'Business assertion', 'blocked', 'Scorecard passed, but no issue-specific business assertion proof was recorded.', [], now));
|
|
605
|
+
return {
|
|
606
|
+
outcome: 'false_pass',
|
|
607
|
+
reason: 'Scorecard-only proof is not acceptance.',
|
|
608
|
+
nextAction: 'Record issue-specific workflow/data proof, then reclassify the run.',
|
|
609
|
+
gates: gates,
|
|
610
|
+
warnings: warnings,
|
|
611
|
+
recordedAt: now
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
var statusPhase = "".concat(input.status || '', " ").concat(input.phase || '');
|
|
615
|
+
if ((input.explicitAccepted === true || statusLooksPassed(statusPhase) || scorecardPassed) && hasBusinessPass) {
|
|
616
|
+
return {
|
|
617
|
+
outcome: 'accepted',
|
|
618
|
+
reason: 'Run has terminal success signal and issue-specific business assertion proof.',
|
|
619
|
+
nextAction: 'No repair action required.',
|
|
620
|
+
gates: gates,
|
|
621
|
+
warnings: warnings,
|
|
622
|
+
recordedAt: now
|
|
623
|
+
};
|
|
624
|
+
}
|
|
625
|
+
if (statusLooksFailed(statusPhase)) {
|
|
626
|
+
return {
|
|
627
|
+
outcome: 'rejected',
|
|
628
|
+
reason: 'Run ended with a failure status and no accepted proof.',
|
|
629
|
+
nextAction: 'Classify the failing gate and rerun the smallest repair step.',
|
|
630
|
+
gates: gates,
|
|
631
|
+
warnings: warnings,
|
|
632
|
+
recordedAt: now
|
|
633
|
+
};
|
|
634
|
+
}
|
|
635
|
+
return {
|
|
636
|
+
outcome: 'unknown',
|
|
637
|
+
reason: 'Run does not have enough normalized evidence for a terminal label.',
|
|
638
|
+
nextAction: 'Ingest QA, deploy, assistant, usage, and commit evidence before using this run for training.',
|
|
639
|
+
gates: gates,
|
|
640
|
+
warnings: warnings,
|
|
641
|
+
recordedAt: now
|
|
642
|
+
};
|
|
643
|
+
}
|
|
644
|
+
function buildAIRun(input) {
|
|
645
|
+
var decision = input.outcome
|
|
646
|
+
? {
|
|
647
|
+
outcome: input.outcome,
|
|
648
|
+
gates: input.gates || [],
|
|
649
|
+
warnings: input.warnings || [],
|
|
650
|
+
nextAction: input.nextAction || '',
|
|
651
|
+
reason: '',
|
|
652
|
+
recordedAt: isoNow(input.now)
|
|
653
|
+
}
|
|
654
|
+
: classifyAIRunOutcome({
|
|
655
|
+
source: input.source,
|
|
656
|
+
status: input.status,
|
|
657
|
+
phase: input.phase,
|
|
658
|
+
qa: input.qa,
|
|
659
|
+
gates: input.gates,
|
|
660
|
+
scorecardPassed: input.scorecardPassed,
|
|
661
|
+
deployStatus: input.deployStatus,
|
|
662
|
+
publishStatus: input.publishStatus,
|
|
663
|
+
sampleDataStatus: input.sampleDataStatus,
|
|
664
|
+
manualHandoff: input.manualHandoff,
|
|
665
|
+
stopped: input.stopped,
|
|
666
|
+
rejected: input.rejected,
|
|
667
|
+
explicitAccepted: input.explicitAccepted,
|
|
668
|
+
terminal: input.terminal,
|
|
669
|
+
now: input.now
|
|
670
|
+
});
|
|
671
|
+
return {
|
|
672
|
+
id: input.id,
|
|
673
|
+
source: input.source || 'unknown',
|
|
674
|
+
sourceIds: input.sourceIds || {},
|
|
675
|
+
title: input.title,
|
|
676
|
+
status: input.status,
|
|
677
|
+
phase: input.phase,
|
|
678
|
+
startedAt: input.startedAt,
|
|
679
|
+
completedAt: input.completedAt,
|
|
680
|
+
outcome: decision.outcome,
|
|
681
|
+
events: Array.isArray(input.events) ? input.events : [],
|
|
682
|
+
gates: decision.gates,
|
|
683
|
+
qa: normalizeQaRun(input.qa),
|
|
684
|
+
cost: input.cost,
|
|
685
|
+
nextAction: decision.nextAction,
|
|
686
|
+
warnings: decision.warnings,
|
|
687
|
+
metadata: input.metadata
|
|
688
|
+
};
|
|
689
|
+
}
|
|
690
|
+
function buildAIRunCost(entries) {
|
|
691
|
+
var e_5, _a, e_6, _b, e_7, _c, e_8, _d;
|
|
692
|
+
var _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
693
|
+
if (entries === void 0) { entries = []; }
|
|
694
|
+
var cost = {
|
|
695
|
+
inputTokens: 0,
|
|
696
|
+
cachedInputTokens: 0,
|
|
697
|
+
outputTokens: 0,
|
|
698
|
+
totalTokens: 0,
|
|
699
|
+
estimatedUsd: 0,
|
|
700
|
+
models: [],
|
|
701
|
+
categories: {},
|
|
702
|
+
sources: {},
|
|
703
|
+
surfaces: {},
|
|
704
|
+
manualEstimatedUsd: 0,
|
|
705
|
+
untrackedEstimatedUsd: 0,
|
|
706
|
+
untrackedWarnings: []
|
|
707
|
+
};
|
|
708
|
+
try {
|
|
709
|
+
for (var _x = __values(normalizeOpenAIUsageRowsForCosting(entries)), _y = _x.next(); !_y.done; _y = _x.next()) {
|
|
710
|
+
var entry = _y.value;
|
|
711
|
+
var category = cleanText(entry.category, 120) || 'unknown';
|
|
712
|
+
var source = cleanText((_e = entry.usage_source) !== null && _e !== void 0 ? _e : entry.usageSource, 80) || 'unknown';
|
|
713
|
+
var surface = cleanText((_f = entry.usage_surface) !== null && _f !== void 0 ? _f : entry.usageSurface, 80) || 'unknown';
|
|
714
|
+
var isManual = entry.is_manual === true || entry.isManual === true || source === 'manual_codex';
|
|
715
|
+
var isUntracked = entry.is_untracked === true || entry.isUntracked === true;
|
|
716
|
+
var untrackedReason = cleanText((_g = entry.untracked_reason) !== null && _g !== void 0 ? _g : entry.untrackedReason, 500);
|
|
717
|
+
var model = cleanText(entry.model, 120);
|
|
718
|
+
var inputTokens = Number((_j = (_h = entry.input_tokens) !== null && _h !== void 0 ? _h : entry.inputTokens) !== null && _j !== void 0 ? _j : 0) || 0;
|
|
719
|
+
var cachedInputTokens = Number((_l = (_k = entry.cached_input_tokens) !== null && _k !== void 0 ? _k : entry.cachedInputTokens) !== null && _l !== void 0 ? _l : 0) || 0;
|
|
720
|
+
var outputTokens = Number((_o = (_m = entry.output_tokens) !== null && _m !== void 0 ? _m : entry.outputTokens) !== null && _o !== void 0 ? _o : 0) || 0;
|
|
721
|
+
var totalTokens = Number((_q = (_p = entry.total_tokens) !== null && _p !== void 0 ? _p : entry.totalTokens) !== null && _q !== void 0 ? _q : (inputTokens + outputTokens)) || 0;
|
|
722
|
+
var estimatedUsd = Number((_s = (_r = entry.cost_estimate) !== null && _r !== void 0 ? _r : entry.estimatedUsd) !== null && _s !== void 0 ? _s : 0) || 0;
|
|
723
|
+
cost.inputTokens += inputTokens;
|
|
724
|
+
cost.cachedInputTokens += cachedInputTokens;
|
|
725
|
+
cost.outputTokens += outputTokens;
|
|
726
|
+
cost.totalTokens += totalTokens;
|
|
727
|
+
cost.estimatedUsd += estimatedUsd;
|
|
728
|
+
if (isManual) {
|
|
729
|
+
cost.manualEstimatedUsd = Number(cost.manualEstimatedUsd || 0) + estimatedUsd;
|
|
730
|
+
}
|
|
731
|
+
if (isUntracked) {
|
|
732
|
+
cost.untrackedEstimatedUsd = Number(cost.untrackedEstimatedUsd || 0) + estimatedUsd;
|
|
733
|
+
var warning = untrackedReason || "".concat(source, " usage is an estimate outside managed runner telemetry.");
|
|
734
|
+
if (warning && !((_t = cost.untrackedWarnings) === null || _t === void 0 ? void 0 : _t.includes(warning))) {
|
|
735
|
+
(_u = cost.untrackedWarnings) === null || _u === void 0 ? void 0 : _u.push(warning);
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
if (model && !cost.models.includes(model)) {
|
|
739
|
+
cost.models.push(model);
|
|
740
|
+
}
|
|
741
|
+
if (!cost.categories[category]) {
|
|
742
|
+
cost.categories[category] = {
|
|
743
|
+
inputTokens: 0,
|
|
744
|
+
cachedInputTokens: 0,
|
|
745
|
+
outputTokens: 0,
|
|
746
|
+
totalTokens: 0,
|
|
747
|
+
estimatedUsd: 0,
|
|
748
|
+
count: 0
|
|
749
|
+
};
|
|
750
|
+
}
|
|
751
|
+
cost.categories[category].inputTokens += inputTokens;
|
|
752
|
+
cost.categories[category].cachedInputTokens += cachedInputTokens;
|
|
753
|
+
cost.categories[category].outputTokens += outputTokens;
|
|
754
|
+
cost.categories[category].totalTokens += totalTokens;
|
|
755
|
+
cost.categories[category].estimatedUsd += estimatedUsd;
|
|
756
|
+
cost.categories[category].count += 1;
|
|
757
|
+
if (!((_v = cost.sources) === null || _v === void 0 ? void 0 : _v[source])) {
|
|
758
|
+
cost.sources[source] = {
|
|
759
|
+
inputTokens: 0,
|
|
760
|
+
cachedInputTokens: 0,
|
|
761
|
+
outputTokens: 0,
|
|
762
|
+
totalTokens: 0,
|
|
763
|
+
estimatedUsd: 0,
|
|
764
|
+
count: 0,
|
|
765
|
+
manualCount: 0,
|
|
766
|
+
untrackedCount: 0
|
|
767
|
+
};
|
|
768
|
+
}
|
|
769
|
+
cost.sources[source].inputTokens += inputTokens;
|
|
770
|
+
cost.sources[source].cachedInputTokens += cachedInputTokens;
|
|
771
|
+
cost.sources[source].outputTokens += outputTokens;
|
|
772
|
+
cost.sources[source].totalTokens += totalTokens;
|
|
773
|
+
cost.sources[source].estimatedUsd += estimatedUsd;
|
|
774
|
+
cost.sources[source].count += 1;
|
|
775
|
+
if (isManual) {
|
|
776
|
+
cost.sources[source].manualCount += 1;
|
|
777
|
+
}
|
|
778
|
+
if (isUntracked) {
|
|
779
|
+
cost.sources[source].untrackedCount += 1;
|
|
780
|
+
}
|
|
781
|
+
if (!((_w = cost.surfaces) === null || _w === void 0 ? void 0 : _w[surface])) {
|
|
782
|
+
cost.surfaces[surface] = {
|
|
783
|
+
totalTokens: 0,
|
|
784
|
+
estimatedUsd: 0,
|
|
785
|
+
count: 0
|
|
786
|
+
};
|
|
787
|
+
}
|
|
788
|
+
cost.surfaces[surface].totalTokens += totalTokens;
|
|
789
|
+
cost.surfaces[surface].estimatedUsd += estimatedUsd;
|
|
790
|
+
cost.surfaces[surface].count += 1;
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
794
|
+
finally {
|
|
795
|
+
try {
|
|
796
|
+
if (_y && !_y.done && (_a = _x.return)) _a.call(_x);
|
|
797
|
+
}
|
|
798
|
+
finally { if (e_5) throw e_5.error; }
|
|
799
|
+
}
|
|
800
|
+
cost.estimatedUsd = Number(cost.estimatedUsd.toFixed(6));
|
|
801
|
+
cost.manualEstimatedUsd = Number(Number(cost.manualEstimatedUsd || 0).toFixed(6));
|
|
802
|
+
cost.untrackedEstimatedUsd = Number(Number(cost.untrackedEstimatedUsd || 0).toFixed(6));
|
|
803
|
+
try {
|
|
804
|
+
for (var _z = __values(Object.keys(cost.categories)), _0 = _z.next(); !_0.done; _0 = _z.next()) {
|
|
805
|
+
var category = _0.value;
|
|
806
|
+
cost.categories[category].estimatedUsd = Number(cost.categories[category].estimatedUsd.toFixed(6));
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
810
|
+
finally {
|
|
811
|
+
try {
|
|
812
|
+
if (_0 && !_0.done && (_b = _z.return)) _b.call(_z);
|
|
813
|
+
}
|
|
814
|
+
finally { if (e_6) throw e_6.error; }
|
|
815
|
+
}
|
|
816
|
+
try {
|
|
817
|
+
for (var _1 = __values(Object.keys(cost.sources || {})), _2 = _1.next(); !_2.done; _2 = _1.next()) {
|
|
818
|
+
var source = _2.value;
|
|
819
|
+
cost.sources[source].estimatedUsd = Number(cost.sources[source].estimatedUsd.toFixed(6));
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
823
|
+
finally {
|
|
824
|
+
try {
|
|
825
|
+
if (_2 && !_2.done && (_c = _1.return)) _c.call(_1);
|
|
826
|
+
}
|
|
827
|
+
finally { if (e_7) throw e_7.error; }
|
|
828
|
+
}
|
|
829
|
+
try {
|
|
830
|
+
for (var _3 = __values(Object.keys(cost.surfaces || {})), _4 = _3.next(); !_4.done; _4 = _3.next()) {
|
|
831
|
+
var surface = _4.value;
|
|
832
|
+
cost.surfaces[surface].estimatedUsd = Number(cost.surfaces[surface].estimatedUsd.toFixed(6));
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
836
|
+
finally {
|
|
837
|
+
try {
|
|
838
|
+
if (_4 && !_4.done && (_d = _3.return)) _d.call(_3);
|
|
839
|
+
}
|
|
840
|
+
finally { if (e_8) throw e_8.error; }
|
|
841
|
+
}
|
|
842
|
+
return cost;
|
|
843
|
+
}
|
|
844
|
+
function redactAIRunTrainingExample(example) {
|
|
845
|
+
var redact = function (value) { return cleanText(value, 5000)
|
|
846
|
+
.replace(/mongodb(?:\+srv)?:\/\/[^\s"'<>]+/ig, '[redacted-mongo-url]')
|
|
847
|
+
.replace(/\b(?:sk|ghp|xoxb|AKIA)[A-Za-z0-9_\-]{12,}\b/g, '[redacted-secret]')
|
|
848
|
+
.replace(/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z]{2,}\b/ig, '[redacted-email]'); };
|
|
849
|
+
return __assign(__assign({}, example), { inputSummary: redact(example.inputSummary), actionSummary: redact(example.actionSummary), evidence: cleanList(example.evidence, 80, 5000).map(redact) });
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
//# sourceMappingURL=ai-run-evidence.js.map
|