@resolveio/server-lib 22.3.197 → 22.3.199
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 +4410 -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,4410 @@
|
|
|
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.evaluateAssistantAnswerQuality = evaluateAssistantAnswerQuality;
|
|
51
|
+
exports.buildAssistantAnswerActionabilityContract = buildAssistantAnswerActionabilityContract;
|
|
52
|
+
exports.buildSupportAIRunFromEvidence = buildSupportAIRunFromEvidence;
|
|
53
|
+
exports.buildAICoderAIRunFromEvidence = buildAICoderAIRunFromEvidence;
|
|
54
|
+
exports.buildAssistantAIRunFromEvidence = buildAssistantAIRunFromEvidence;
|
|
55
|
+
var ai_run_evidence_1 = require("./ai-run-evidence");
|
|
56
|
+
var aicoder_runner_v6_1 = require("./aicoder-runner-v6");
|
|
57
|
+
var ai_runner_manager_policy_1 = require("./ai-runner-manager-policy");
|
|
58
|
+
var support_runner_v5_1 = require("./support-runner-v5");
|
|
59
|
+
function cleanText(value, max) {
|
|
60
|
+
if (max === void 0) { max = 1000; }
|
|
61
|
+
return String(value || '').replace(/\s+/g, ' ').trim().slice(0, max);
|
|
62
|
+
}
|
|
63
|
+
function idText(value, max) {
|
|
64
|
+
if (max === void 0) { max = 160; }
|
|
65
|
+
var normalized = cleanText(value, max);
|
|
66
|
+
return normalized || undefined;
|
|
67
|
+
}
|
|
68
|
+
function asArray(value) {
|
|
69
|
+
return Array.isArray(value) ? value : [];
|
|
70
|
+
}
|
|
71
|
+
function cleanStringList(value, limit, max) {
|
|
72
|
+
if (limit === void 0) { limit = 40; }
|
|
73
|
+
if (max === void 0) { max = 500; }
|
|
74
|
+
return asArray(value)
|
|
75
|
+
.map(function (entry) { return cleanText(entry, max); })
|
|
76
|
+
.filter(Boolean)
|
|
77
|
+
.slice(0, limit);
|
|
78
|
+
}
|
|
79
|
+
function plainObject(value) {
|
|
80
|
+
return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
81
|
+
}
|
|
82
|
+
function firstText(source, fields, max) {
|
|
83
|
+
var e_1, _a;
|
|
84
|
+
if (max === void 0) { max = 1000; }
|
|
85
|
+
try {
|
|
86
|
+
for (var fields_1 = __values(fields), fields_1_1 = fields_1.next(); !fields_1_1.done; fields_1_1 = fields_1.next()) {
|
|
87
|
+
var field = fields_1_1.value;
|
|
88
|
+
var value = source === null || source === void 0 ? void 0 : source[field];
|
|
89
|
+
var normalized = idText(value, max);
|
|
90
|
+
if (normalized) {
|
|
91
|
+
return normalized;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
96
|
+
finally {
|
|
97
|
+
try {
|
|
98
|
+
if (fields_1_1 && !fields_1_1.done && (_a = fields_1.return)) _a.call(fields_1);
|
|
99
|
+
}
|
|
100
|
+
finally { if (e_1) throw e_1.error; }
|
|
101
|
+
}
|
|
102
|
+
return undefined;
|
|
103
|
+
}
|
|
104
|
+
function dateValue(source, fields) {
|
|
105
|
+
var e_2, _a;
|
|
106
|
+
try {
|
|
107
|
+
for (var fields_2 = __values(fields), fields_2_1 = fields_2.next(); !fields_2_1.done; fields_2_1 = fields_2.next()) {
|
|
108
|
+
var field = fields_2_1.value;
|
|
109
|
+
var value = source === null || source === void 0 ? void 0 : source[field];
|
|
110
|
+
if (value) {
|
|
111
|
+
return value;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
116
|
+
finally {
|
|
117
|
+
try {
|
|
118
|
+
if (fields_2_1 && !fields_2_1.done && (_a = fields_2.return)) _a.call(fields_2);
|
|
119
|
+
}
|
|
120
|
+
finally { if (e_2) throw e_2.error; }
|
|
121
|
+
}
|
|
122
|
+
return undefined;
|
|
123
|
+
}
|
|
124
|
+
function addSourceId(sourceIds, key, value) {
|
|
125
|
+
var normalized = idText(value);
|
|
126
|
+
if (normalized) {
|
|
127
|
+
sourceIds[key] = normalized;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
function pushEvent(events, event) {
|
|
131
|
+
var _a;
|
|
132
|
+
var message = cleanText(event.message, 1800);
|
|
133
|
+
var metadata = event.metadata || {};
|
|
134
|
+
if (!message && !Object.keys(metadata).length && !((_a = event.artifactPaths) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
events.push(__assign(__assign({}, event), { message: message, artifactPaths: asArray(event.artifactPaths).filter(Boolean).slice(0, 20) }));
|
|
138
|
+
}
|
|
139
|
+
function eventDate(record) {
|
|
140
|
+
return dateValue(record, ['recordedAt', 'createdAt', 'updatedAt', 'timestamp', 'time', 'date']);
|
|
141
|
+
}
|
|
142
|
+
function normalizeManagerFailureRecord(value, fallback) {
|
|
143
|
+
if (fallback === void 0) { fallback = {}; }
|
|
144
|
+
var entry = plainObject(value);
|
|
145
|
+
if (!Object.keys(entry).length && !Object.keys(fallback).length) {
|
|
146
|
+
return undefined;
|
|
147
|
+
}
|
|
148
|
+
var blocker = cleanText(entry.blocker || entry.reason || entry.summary || entry.message || fallback.blocker || fallback.summary, 1200);
|
|
149
|
+
var failureClass = cleanText(entry.failureClass || entry.failure_class || entry.class || fallback.failureClass, 120);
|
|
150
|
+
var evidenceHash = cleanText(entry.evidenceHash || entry.evidence_hash || entry.hash || fallback.evidenceHash, 180);
|
|
151
|
+
var blockerFingerprint = cleanText(entry.blockerFingerprint || entry.blocker_fingerprint || fallback.blockerFingerprint, 180);
|
|
152
|
+
var lane = cleanText(entry.lane || fallback.lane || 'support', 80);
|
|
153
|
+
var stepType = cleanText(entry.stepType || entry.step_type || entry.type || fallback.stepType || 'support_step', 80);
|
|
154
|
+
var outcome = cleanText(entry.outcome || entry.status || entry.result || fallback.outcome || 'needs_repair', 80);
|
|
155
|
+
if (!blocker && !failureClass && !evidenceHash && !blockerFingerprint) {
|
|
156
|
+
return undefined;
|
|
157
|
+
}
|
|
158
|
+
return {
|
|
159
|
+
lane: lane,
|
|
160
|
+
stepType: stepType,
|
|
161
|
+
outcome: outcome,
|
|
162
|
+
failureClass: failureClass || undefined,
|
|
163
|
+
blocker: blocker || undefined,
|
|
164
|
+
summary: cleanText(entry.summary || entry.message || fallback.summary, 1200) || undefined,
|
|
165
|
+
blockerFingerprint: blockerFingerprint || undefined,
|
|
166
|
+
evidenceHash: evidenceHash || undefined,
|
|
167
|
+
changedFiles: cleanStringList(entry.changedFiles || entry.changed_files || fallback.changedFiles, 80, 500),
|
|
168
|
+
artifactPaths: cleanStringList(entry.artifactPaths || entry.artifact_paths || entry.artifacts || fallback.artifactPaths, 80, 500)
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
function supportManagerFailureRecords(job, evidence) {
|
|
172
|
+
var e_3, _a, e_4, _b;
|
|
173
|
+
var records = [];
|
|
174
|
+
var pushRecord = function (value, fallback) {
|
|
175
|
+
if (fallback === void 0) { fallback = {}; }
|
|
176
|
+
var record = normalizeManagerFailureRecord(value, fallback);
|
|
177
|
+
if (record) {
|
|
178
|
+
records.push(record);
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
try {
|
|
182
|
+
for (var _c = __values(asArray(job.supportV5StepHistory || job.support_v5_step_history || evidence.supportV5StepHistory || evidence.support_v5_step_history)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
183
|
+
var entry = _d.value;
|
|
184
|
+
pushRecord(entry);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
188
|
+
finally {
|
|
189
|
+
try {
|
|
190
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
191
|
+
}
|
|
192
|
+
finally { if (e_3) throw e_3.error; }
|
|
193
|
+
}
|
|
194
|
+
try {
|
|
195
|
+
for (var _e = __values(asArray(job.supportV5FailureFingerprints || job.support_v5_failure_fingerprints || evidence.supportV5FailureFingerprints || evidence.support_v5_failure_fingerprints)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
196
|
+
var entry = _f.value;
|
|
197
|
+
var fingerprint = plainObject(entry);
|
|
198
|
+
var count = Math.max(1, Math.min(8, Number(fingerprint.count || fingerprint.repeatedCount || fingerprint.repeated_count || 1) || 1));
|
|
199
|
+
var fallback = {
|
|
200
|
+
lane: cleanText(fingerprint.lane || 'support', 80),
|
|
201
|
+
stepType: cleanText(fingerprint.stepType || fingerprint.step_type || 'support_step', 80),
|
|
202
|
+
outcome: cleanText(fingerprint.outcome || 'needs_repair', 80),
|
|
203
|
+
failureClass: cleanText(fingerprint.failureClass || fingerprint.failure_class || fingerprint.class, 120),
|
|
204
|
+
blocker: cleanText(fingerprint.blocker || fingerprint.reason || fingerprint.summary, 1200),
|
|
205
|
+
blockerFingerprint: cleanText(fingerprint.blockerFingerprint || fingerprint.blocker_fingerprint, 180),
|
|
206
|
+
evidenceHash: cleanText(fingerprint.evidenceHash || fingerprint.evidence_hash, 180)
|
|
207
|
+
};
|
|
208
|
+
for (var index = 0; index < count; index += 1) {
|
|
209
|
+
pushRecord(fingerprint, fallback);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
214
|
+
finally {
|
|
215
|
+
try {
|
|
216
|
+
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
217
|
+
}
|
|
218
|
+
finally { if (e_4) throw e_4.error; }
|
|
219
|
+
}
|
|
220
|
+
var currentFailure = evidenceObject(job.supportV5CurrentFailure, job.support_v5_current_failure, job.supportV5RecoveryCurrent, job.support_v5_recovery_current, evidence.currentFailure, evidence.current_failure);
|
|
221
|
+
pushRecord(currentFailure);
|
|
222
|
+
return records.slice(-80);
|
|
223
|
+
}
|
|
224
|
+
function managerNoBlindLoopGateFromHistory(history, budgetSource, now) {
|
|
225
|
+
var _a;
|
|
226
|
+
if (!history.length) {
|
|
227
|
+
return undefined;
|
|
228
|
+
}
|
|
229
|
+
var budget = plainObject(budgetSource);
|
|
230
|
+
var maxSameFailureRepeats = Math.max(1, Number(budget.maxRepeatedNoProgress || budget.max_repeated_no_progress || budget.maxSameFailureRepeats || budget.max_same_failure_repeats || 3) || 3);
|
|
231
|
+
var decision = (0, ai_runner_manager_policy_1.decideResolveIOAIManagerPolicy)({
|
|
232
|
+
history: history,
|
|
233
|
+
maxSameFailureRepeats: maxSameFailureRepeats
|
|
234
|
+
});
|
|
235
|
+
var parksRun = /^(park_repeated_failure|park_ping_pong|manual_handoff)$/.test(decision.action);
|
|
236
|
+
var status = parksRun
|
|
237
|
+
? 'blocked'
|
|
238
|
+
: decision.action === 'retry_infra'
|
|
239
|
+
? 'warn'
|
|
240
|
+
: 'pass';
|
|
241
|
+
return {
|
|
242
|
+
key: 'manager_no_blind_loop_policy',
|
|
243
|
+
label: 'No-blind-loop manager policy',
|
|
244
|
+
status: status,
|
|
245
|
+
reason: decision.reason,
|
|
246
|
+
evidenceRefs: cleanStringList(decision.recoveryAction.requiredArtifacts, 20, 500),
|
|
247
|
+
recordedAt: isoNow(now),
|
|
248
|
+
metadata: {
|
|
249
|
+
action: decision.action,
|
|
250
|
+
failureClass: decision.failureClass,
|
|
251
|
+
blockerFingerprint: decision.blockerFingerprint,
|
|
252
|
+
evidenceHash: decision.evidenceHash,
|
|
253
|
+
sameFailureCount: decision.sameFailureCount,
|
|
254
|
+
pingPongCount: decision.pingPongCount,
|
|
255
|
+
newEvidence: decision.newEvidence,
|
|
256
|
+
materialEvidence: decision.materialEvidence,
|
|
257
|
+
evidenceStrength: decision.evidenceStrength,
|
|
258
|
+
evidenceSignals: decision.evidenceSignals,
|
|
259
|
+
loopBudgetShouldReset: decision.loopBudgetShouldReset,
|
|
260
|
+
productRepairFailure: decision.productRepairFailure,
|
|
261
|
+
recoveryClass: decision.recoveryPlan.recoveryClass,
|
|
262
|
+
allowedAction: decision.recoveryPlan.allowedAction,
|
|
263
|
+
dispatchAction: decision.recoveryAction.allowedDispatchAction,
|
|
264
|
+
evidenceOnly: decision.recoveryAction.evidenceOnly,
|
|
265
|
+
productRepairAllowed: decision.recoveryAction.productRepairAllowed,
|
|
266
|
+
expensiveModelAllowed: decision.recoveryAction.expensiveModelAllowed,
|
|
267
|
+
costCeilingUsd: decision.recoveryAction.costCeilingUsd,
|
|
268
|
+
requiresNewEvidence: ((_a = decision.recoveryAction.retryPolicy) === null || _a === void 0 ? void 0 : _a.requireNewEvidence) === true,
|
|
269
|
+
nextCommands: decision.recoveryAction.nextCommands,
|
|
270
|
+
requiredEvidence: decision.recoveryAction.requiredArtifacts,
|
|
271
|
+
forbiddenActions: decision.recoveryPlan.forbiddenActions
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
function managerRecoveryExecutionProofGate(proof, now) {
|
|
276
|
+
if (!proof || !Object.keys(proof).length) {
|
|
277
|
+
return undefined;
|
|
278
|
+
}
|
|
279
|
+
var validation = (0, ai_runner_manager_policy_1.validateResolveIOAIManagerRecoveryExecutionProofContract)(proof);
|
|
280
|
+
var normalized = validation.normalized;
|
|
281
|
+
var statusText = cleanText(normalized.status, 120);
|
|
282
|
+
var gateStatus = validation.valid && normalized.canContinueRun === true && statusText === 'proof_ready'
|
|
283
|
+
? 'pass'
|
|
284
|
+
: statusText === 'manual_handoff'
|
|
285
|
+
? 'warn'
|
|
286
|
+
: 'blocked';
|
|
287
|
+
return {
|
|
288
|
+
key: 'manager_recovery_execution_proof',
|
|
289
|
+
label: 'Manager recovery execution proof',
|
|
290
|
+
status: gateStatus,
|
|
291
|
+
reason: normalized.blockers[0] || validation.blockers[0] || statusText || 'Manager recovery execution proof recorded.',
|
|
292
|
+
evidenceRefs: normalized.artifactPaths,
|
|
293
|
+
recordedAt: isoNow(now || normalized.createdAt),
|
|
294
|
+
metadata: {
|
|
295
|
+
contractId: normalized.contractId,
|
|
296
|
+
directiveId: normalized.directiveId,
|
|
297
|
+
surface: normalized.surface,
|
|
298
|
+
dispatchAction: normalized.dispatchAction,
|
|
299
|
+
phase: normalized.phase,
|
|
300
|
+
status: statusText,
|
|
301
|
+
canContinueRun: normalized.canContinueRun,
|
|
302
|
+
canRunProductRepair: normalized.canRunProductRepair,
|
|
303
|
+
canRunExpensiveModel: normalized.canRunExpensiveModel,
|
|
304
|
+
canResetLoopBudget: normalized.canResetLoopBudget,
|
|
305
|
+
proofRequiredBeforeContinuation: normalized.proofRequiredBeforeContinuation,
|
|
306
|
+
requiresNewEvidence: normalized.requiresNewEvidence,
|
|
307
|
+
newEvidence: normalized.newEvidence,
|
|
308
|
+
materialEvidence: normalized.materialEvidence,
|
|
309
|
+
evidenceStrength: normalized.evidenceStrength,
|
|
310
|
+
evidenceSignals: normalized.evidenceSignals,
|
|
311
|
+
startingFailureClass: normalized.startingFailureClass,
|
|
312
|
+
startingBlockerFingerprint: normalized.startingBlockerFingerprint,
|
|
313
|
+
startingEvidenceHash: normalized.startingEvidenceHash,
|
|
314
|
+
latestFailureClass: normalized.latestFailureClass,
|
|
315
|
+
latestBlockerFingerprint: normalized.latestBlockerFingerprint,
|
|
316
|
+
latestEvidenceHash: normalized.latestEvidenceHash,
|
|
317
|
+
requiredEvidence: normalized.requiredEvidence,
|
|
318
|
+
missingEvidence: normalized.missingEvidence,
|
|
319
|
+
changedFiles: normalized.changedFiles,
|
|
320
|
+
blockers: Array.from(new Set(__spreadArray(__spreadArray([], __read(normalized.blockers), false), __read(validation.blockers), false))),
|
|
321
|
+
nextAllowedAction: normalized.nextAllowedAction,
|
|
322
|
+
forbiddenActions: normalized.forbiddenActions
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
function supportManagerNoBlindLoopGate(job, evidence, now) {
|
|
327
|
+
return managerNoBlindLoopGateFromHistory(supportManagerFailureRecords(job, evidence), job.supportV5Budget || job.support_v5_budget || evidence.supportV5Budget || evidence.support_v5_budget, now);
|
|
328
|
+
}
|
|
329
|
+
function aicoderManagerFailureRecords(app, job, evidence) {
|
|
330
|
+
var e_5, _a, e_6, _b, e_7, _c, e_8, _d;
|
|
331
|
+
var records = [];
|
|
332
|
+
var pushRecord = function (value, fallback) {
|
|
333
|
+
if (fallback === void 0) { fallback = {}; }
|
|
334
|
+
var record = normalizeManagerFailureRecord(value, __assign({ lane: 'aicoder', stepType: 'workflow_step' }, fallback));
|
|
335
|
+
if (record) {
|
|
336
|
+
records.push(record);
|
|
337
|
+
}
|
|
338
|
+
};
|
|
339
|
+
var historySources = [
|
|
340
|
+
job.aicoderV6StepHistory,
|
|
341
|
+
job.aiCoderV6StepHistory,
|
|
342
|
+
job.aicoder_v6_step_history,
|
|
343
|
+
job.ai_coder_v6_step_history,
|
|
344
|
+
job.workflowStepHistory,
|
|
345
|
+
job.workflow_step_history,
|
|
346
|
+
job.stepHistory,
|
|
347
|
+
job.step_history,
|
|
348
|
+
job.managerFailureHistory,
|
|
349
|
+
job.manager_failure_history,
|
|
350
|
+
app.aicoderV6StepHistory,
|
|
351
|
+
app.aiCoderV6StepHistory,
|
|
352
|
+
app.aicoder_v6_step_history,
|
|
353
|
+
app.ai_coder_v6_step_history,
|
|
354
|
+
app.workflowStepHistory,
|
|
355
|
+
app.workflow_step_history,
|
|
356
|
+
evidence.aicoderV6StepHistory,
|
|
357
|
+
evidence.aiCoderV6StepHistory,
|
|
358
|
+
evidence.aicoder_v6_step_history,
|
|
359
|
+
evidence.ai_coder_v6_step_history,
|
|
360
|
+
evidence.workflowStepHistory,
|
|
361
|
+
evidence.workflow_step_history,
|
|
362
|
+
evidence.stepHistory,
|
|
363
|
+
evidence.step_history,
|
|
364
|
+
evidence.managerFailureHistory,
|
|
365
|
+
evidence.manager_failure_history
|
|
366
|
+
];
|
|
367
|
+
try {
|
|
368
|
+
for (var historySources_1 = __values(historySources), historySources_1_1 = historySources_1.next(); !historySources_1_1.done; historySources_1_1 = historySources_1.next()) {
|
|
369
|
+
var source = historySources_1_1.value;
|
|
370
|
+
try {
|
|
371
|
+
for (var _e = (e_6 = void 0, __values(asArray(source))), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
372
|
+
var entry = _f.value;
|
|
373
|
+
pushRecord(entry);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
377
|
+
finally {
|
|
378
|
+
try {
|
|
379
|
+
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
380
|
+
}
|
|
381
|
+
finally { if (e_6) throw e_6.error; }
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
386
|
+
finally {
|
|
387
|
+
try {
|
|
388
|
+
if (historySources_1_1 && !historySources_1_1.done && (_a = historySources_1.return)) _a.call(historySources_1);
|
|
389
|
+
}
|
|
390
|
+
finally { if (e_5) throw e_5.error; }
|
|
391
|
+
}
|
|
392
|
+
var fingerprintSources = [
|
|
393
|
+
job.aicoderV6FailureFingerprints,
|
|
394
|
+
job.aiCoderV6FailureFingerprints,
|
|
395
|
+
job.aicoder_v6_failure_fingerprints,
|
|
396
|
+
job.ai_coder_v6_failure_fingerprints,
|
|
397
|
+
job.workflowFailureFingerprints,
|
|
398
|
+
job.workflow_failure_fingerprints,
|
|
399
|
+
job.failureFingerprints,
|
|
400
|
+
job.failure_fingerprints,
|
|
401
|
+
app.aicoderV6FailureFingerprints,
|
|
402
|
+
app.aiCoderV6FailureFingerprints,
|
|
403
|
+
app.aicoder_v6_failure_fingerprints,
|
|
404
|
+
app.ai_coder_v6_failure_fingerprints,
|
|
405
|
+
evidence.aicoderV6FailureFingerprints,
|
|
406
|
+
evidence.aiCoderV6FailureFingerprints,
|
|
407
|
+
evidence.aicoder_v6_failure_fingerprints,
|
|
408
|
+
evidence.ai_coder_v6_failure_fingerprints,
|
|
409
|
+
evidence.workflowFailureFingerprints,
|
|
410
|
+
evidence.workflow_failure_fingerprints,
|
|
411
|
+
evidence.failureFingerprints,
|
|
412
|
+
evidence.failure_fingerprints
|
|
413
|
+
];
|
|
414
|
+
try {
|
|
415
|
+
for (var fingerprintSources_1 = __values(fingerprintSources), fingerprintSources_1_1 = fingerprintSources_1.next(); !fingerprintSources_1_1.done; fingerprintSources_1_1 = fingerprintSources_1.next()) {
|
|
416
|
+
var source = fingerprintSources_1_1.value;
|
|
417
|
+
try {
|
|
418
|
+
for (var _g = (e_8 = void 0, __values(asArray(source))), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
419
|
+
var entry = _h.value;
|
|
420
|
+
var fingerprint = plainObject(entry);
|
|
421
|
+
var count = Math.max(1, Math.min(8, Number(fingerprint.count || fingerprint.repeatedCount || fingerprint.repeated_count || 1) || 1));
|
|
422
|
+
var fallback = {
|
|
423
|
+
lane: cleanText(fingerprint.lane || 'aicoder', 80),
|
|
424
|
+
stepType: cleanText(fingerprint.stepType || fingerprint.step_type || 'workflow_step', 80),
|
|
425
|
+
outcome: cleanText(fingerprint.outcome || 'needs_repair', 80),
|
|
426
|
+
failureClass: cleanText(fingerprint.failureClass || fingerprint.failure_class || fingerprint.class, 120),
|
|
427
|
+
blocker: cleanText(fingerprint.blocker || fingerprint.reason || fingerprint.summary, 1200),
|
|
428
|
+
blockerFingerprint: cleanText(fingerprint.blockerFingerprint || fingerprint.blocker_fingerprint, 180),
|
|
429
|
+
evidenceHash: cleanText(fingerprint.evidenceHash || fingerprint.evidence_hash, 180)
|
|
430
|
+
};
|
|
431
|
+
for (var index = 0; index < count; index += 1) {
|
|
432
|
+
pushRecord(fingerprint, fallback);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
437
|
+
finally {
|
|
438
|
+
try {
|
|
439
|
+
if (_h && !_h.done && (_d = _g.return)) _d.call(_g);
|
|
440
|
+
}
|
|
441
|
+
finally { if (e_8) throw e_8.error; }
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
446
|
+
finally {
|
|
447
|
+
try {
|
|
448
|
+
if (fingerprintSources_1_1 && !fingerprintSources_1_1.done && (_c = fingerprintSources_1.return)) _c.call(fingerprintSources_1);
|
|
449
|
+
}
|
|
450
|
+
finally { if (e_7) throw e_7.error; }
|
|
451
|
+
}
|
|
452
|
+
var currentFailure = evidenceObject(job.aicoderV6CurrentFailure, job.aiCoderV6CurrentFailure, job.aicoder_v6_current_failure, job.ai_coder_v6_current_failure, job.workflowCurrentFailure, job.workflow_current_failure, job.currentFailure, job.current_failure, evidence.aicoderV6CurrentFailure, evidence.aiCoderV6CurrentFailure, evidence.aicoder_v6_current_failure, evidence.ai_coder_v6_current_failure, evidence.workflowCurrentFailure, evidence.workflow_current_failure, evidence.currentFailure, evidence.current_failure);
|
|
453
|
+
pushRecord(currentFailure);
|
|
454
|
+
return records.slice(-80);
|
|
455
|
+
}
|
|
456
|
+
function aicoderManagerNoBlindLoopGate(app, job, evidence, now) {
|
|
457
|
+
return managerNoBlindLoopGateFromHistory(aicoderManagerFailureRecords(app, job, evidence), job.aicoderV6Budget
|
|
458
|
+
|| job.aiCoderV6Budget
|
|
459
|
+
|| job.aicoder_v6_budget
|
|
460
|
+
|| job.ai_coder_v6_budget
|
|
461
|
+
|| evidence.aicoderV6Budget
|
|
462
|
+
|| evidence.aiCoderV6Budget
|
|
463
|
+
|| evidence.aicoder_v6_budget
|
|
464
|
+
|| evidence.ai_coder_v6_budget
|
|
465
|
+
|| app.aicoderV6Budget
|
|
466
|
+
|| app.aiCoderV6Budget
|
|
467
|
+
|| app.aicoder_v6_budget
|
|
468
|
+
|| app.ai_coder_v6_budget
|
|
469
|
+
|| job.budget
|
|
470
|
+
|| evidence.budget, now);
|
|
471
|
+
}
|
|
472
|
+
function managerNoBlindLoopMetadata(gate) {
|
|
473
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
474
|
+
if (!gate) {
|
|
475
|
+
return undefined;
|
|
476
|
+
}
|
|
477
|
+
return {
|
|
478
|
+
action: cleanText((_a = gate.metadata) === null || _a === void 0 ? void 0 : _a.action, 120),
|
|
479
|
+
status: gate.status,
|
|
480
|
+
failureClass: cleanText((_b = gate.metadata) === null || _b === void 0 ? void 0 : _b.failureClass, 120),
|
|
481
|
+
sameFailureCount: Number(((_c = gate.metadata) === null || _c === void 0 ? void 0 : _c.sameFailureCount) || 0),
|
|
482
|
+
pingPongCount: Number(((_d = gate.metadata) === null || _d === void 0 ? void 0 : _d.pingPongCount) || 0),
|
|
483
|
+
newEvidence: ((_e = gate.metadata) === null || _e === void 0 ? void 0 : _e.newEvidence) === true,
|
|
484
|
+
materialEvidence: ((_f = gate.metadata) === null || _f === void 0 ? void 0 : _f.materialEvidence) === true,
|
|
485
|
+
evidenceStrength: cleanText((_g = gate.metadata) === null || _g === void 0 ? void 0 : _g.evidenceStrength, 120),
|
|
486
|
+
loopBudgetShouldReset: ((_h = gate.metadata) === null || _h === void 0 ? void 0 : _h.loopBudgetShouldReset) === true,
|
|
487
|
+
dispatchAction: cleanText((_j = gate.metadata) === null || _j === void 0 ? void 0 : _j.dispatchAction, 160),
|
|
488
|
+
productRepairAllowed: ((_k = gate.metadata) === null || _k === void 0 ? void 0 : _k.productRepairAllowed) === true,
|
|
489
|
+
expensiveModelAllowed: ((_l = gate.metadata) === null || _l === void 0 ? void 0 : _l.expensiveModelAllowed) === true,
|
|
490
|
+
productRepairFailure: ((_m = gate.metadata) === null || _m === void 0 ? void 0 : _m.productRepairFailure) === true,
|
|
491
|
+
requiresNewEvidence: ((_o = gate.metadata) === null || _o === void 0 ? void 0 : _o.requiresNewEvidence) === true
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
function hotfixEvidenceCandidates() {
|
|
495
|
+
var e_9, _a;
|
|
496
|
+
var sources = [];
|
|
497
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
498
|
+
sources[_i] = arguments[_i];
|
|
499
|
+
}
|
|
500
|
+
var result = [];
|
|
501
|
+
var seen = new Set();
|
|
502
|
+
var pushCandidate = function (value) {
|
|
503
|
+
var e_10, _a, e_11, _b;
|
|
504
|
+
var _c, _d;
|
|
505
|
+
if (Array.isArray(value)) {
|
|
506
|
+
try {
|
|
507
|
+
for (var value_1 = __values(value), value_1_1 = value_1.next(); !value_1_1.done; value_1_1 = value_1.next()) {
|
|
508
|
+
var entry = value_1_1.value;
|
|
509
|
+
pushCandidate(entry);
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
513
|
+
finally {
|
|
514
|
+
try {
|
|
515
|
+
if (value_1_1 && !value_1_1.done && (_a = value_1.return)) _a.call(value_1);
|
|
516
|
+
}
|
|
517
|
+
finally { if (e_10) throw e_10.error; }
|
|
518
|
+
}
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
521
|
+
if (!value || typeof value !== 'object') {
|
|
522
|
+
return;
|
|
523
|
+
}
|
|
524
|
+
var nestedValues = [
|
|
525
|
+
value.hotfixEvidence,
|
|
526
|
+
value.hotfix_evidence,
|
|
527
|
+
value.releaseHotfixEvidence,
|
|
528
|
+
value.release_hotfix_evidence,
|
|
529
|
+
value.managerHotfixEvidence,
|
|
530
|
+
value.manager_hotfix_evidence,
|
|
531
|
+
value.backendHotfixEvidence,
|
|
532
|
+
value.backend_hotfix_evidence
|
|
533
|
+
].filter(Boolean);
|
|
534
|
+
if (nestedValues.length) {
|
|
535
|
+
try {
|
|
536
|
+
for (var nestedValues_1 = __values(nestedValues), nestedValues_1_1 = nestedValues_1.next(); !nestedValues_1_1.done; nestedValues_1_1 = nestedValues_1.next()) {
|
|
537
|
+
var nestedValue = nestedValues_1_1.value;
|
|
538
|
+
pushCandidate(nestedValue);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
542
|
+
finally {
|
|
543
|
+
try {
|
|
544
|
+
if (nestedValues_1_1 && !nestedValues_1_1.done && (_b = nestedValues_1.return)) _b.call(nestedValues_1);
|
|
545
|
+
}
|
|
546
|
+
finally { if (e_11) throw e_11.error; }
|
|
547
|
+
}
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
550
|
+
if (!(value.channel || value.hotfixChannel || value.hotfix_channel)) {
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
var key = JSON.stringify({
|
|
554
|
+
channel: value.channel || value.hotfixChannel || value.hotfix_channel,
|
|
555
|
+
host: ((_c = value.target) === null || _c === void 0 ? void 0 : _c.host) || value.host,
|
|
556
|
+
path: ((_d = value.target) === null || _d === void 0 ? void 0 : _d.path) || value.path || value.remotePath || value.remote_path,
|
|
557
|
+
checksum: value.remoteChecksumAfter || value.remote_checksum_after || value.remoteChecksum || value.remote_checksum
|
|
558
|
+
});
|
|
559
|
+
if (seen.has(key)) {
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
seen.add(key);
|
|
563
|
+
result.push(value);
|
|
564
|
+
};
|
|
565
|
+
try {
|
|
566
|
+
for (var sources_1 = __values(sources), sources_1_1 = sources_1.next(); !sources_1_1.done; sources_1_1 = sources_1.next()) {
|
|
567
|
+
var source = sources_1_1.value;
|
|
568
|
+
pushCandidate(source);
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
572
|
+
finally {
|
|
573
|
+
try {
|
|
574
|
+
if (sources_1_1 && !sources_1_1.done && (_a = sources_1.return)) _a.call(sources_1);
|
|
575
|
+
}
|
|
576
|
+
finally { if (e_9) throw e_9.error; }
|
|
577
|
+
}
|
|
578
|
+
return result;
|
|
579
|
+
}
|
|
580
|
+
function hotfixEvidenceArtifactPaths(evidence, normalized) {
|
|
581
|
+
var _a;
|
|
582
|
+
return [
|
|
583
|
+
normalized === null || normalized === void 0 ? void 0 : normalized.compiledArtifactPath,
|
|
584
|
+
normalized === null || normalized === void 0 ? void 0 : normalized.builtDistPath,
|
|
585
|
+
(_a = normalized === null || normalized === void 0 ? void 0 : normalized.target) === null || _a === void 0 ? void 0 : _a.artifactPath,
|
|
586
|
+
evidence.compiledArtifactPath,
|
|
587
|
+
evidence.compiled_artifact_path,
|
|
588
|
+
evidence.builtDistPath,
|
|
589
|
+
evidence.built_dist_path,
|
|
590
|
+
evidence.artifactPath,
|
|
591
|
+
evidence.artifact_path
|
|
592
|
+
].map(function (entry) { return cleanText(entry, 500); }).filter(Boolean).slice(0, 8);
|
|
593
|
+
}
|
|
594
|
+
function hotfixEvidenceGate(evidence, now) {
|
|
595
|
+
var _a, _b;
|
|
596
|
+
var validation = (0, ai_runner_manager_policy_1.validateResolveIOAIManagerHotfixEvidence)(evidence);
|
|
597
|
+
if (!validation.normalized && validation.status === 'missing') {
|
|
598
|
+
return undefined;
|
|
599
|
+
}
|
|
600
|
+
var status = validation.valid
|
|
601
|
+
? (validation.fullDeployAllowed ? 'warn' : 'pass')
|
|
602
|
+
: validation.status === 'blocked'
|
|
603
|
+
? 'blocked'
|
|
604
|
+
: 'fail';
|
|
605
|
+
var reason = validation.valid
|
|
606
|
+
? validation.fullDeployAllowed
|
|
607
|
+
? 'Hotfix evidence allows exactly one full deploy after force/new-artifact proof.'
|
|
608
|
+
: 'Hotfix evidence is sufficient; rerun the smallest release gate before continuing.'
|
|
609
|
+
: validation.blockers.join('; ');
|
|
610
|
+
return {
|
|
611
|
+
key: 'hotfix_evidence',
|
|
612
|
+
label: 'Hotfix evidence',
|
|
613
|
+
status: status,
|
|
614
|
+
reason: reason,
|
|
615
|
+
evidenceRefs: hotfixEvidenceArtifactPaths(evidence, validation.normalized),
|
|
616
|
+
recordedAt: isoNow(now || ((_a = validation.normalized) === null || _a === void 0 ? void 0 : _a.recordedAt)),
|
|
617
|
+
metadata: {
|
|
618
|
+
channel: validation.channel,
|
|
619
|
+
nextAction: validation.nextAction,
|
|
620
|
+
fullDeployAllowed: validation.fullDeployAllowed,
|
|
621
|
+
fullDeployBlocked: validation.fullDeployBlocked,
|
|
622
|
+
hotfixSatisfied: validation.hotfixSatisfied,
|
|
623
|
+
blockers: validation.blockers,
|
|
624
|
+
githubCommitGuard: validation.githubCommitGuard,
|
|
625
|
+
target: (_b = validation.normalized) === null || _b === void 0 ? void 0 : _b.target
|
|
626
|
+
}
|
|
627
|
+
};
|
|
628
|
+
}
|
|
629
|
+
function hotfixCommitProofGate(evidence, now) {
|
|
630
|
+
var _a;
|
|
631
|
+
var validation = (0, ai_runner_manager_policy_1.validateResolveIOAIManagerHotfixEvidence)(evidence);
|
|
632
|
+
var guard = validation.githubCommitGuard;
|
|
633
|
+
if (!guard.required) {
|
|
634
|
+
return undefined;
|
|
635
|
+
}
|
|
636
|
+
var status = guard.passed
|
|
637
|
+
? 'pass'
|
|
638
|
+
: guard.status === 'invalid'
|
|
639
|
+
? 'fail'
|
|
640
|
+
: 'blocked';
|
|
641
|
+
return {
|
|
642
|
+
key: 'hotfix_commit_proof',
|
|
643
|
+
label: 'Hotfix GitHub commit proof',
|
|
644
|
+
status: status,
|
|
645
|
+
reason: guard.passed
|
|
646
|
+
? 'Hotfix has matching sourceCommitSha, GitHub commit URL, passed gitCommitStatus, and passed gitPushStatus.'
|
|
647
|
+
: (guard.blockers.join('; ') || 'Manager hotfix is blocked until sourceCommitSha, githubCommitUrl, passed gitCommitStatus, and passed gitPushStatus prove the hotfix is committed and pushed to GitHub.'),
|
|
648
|
+
evidenceRefs: cleanStringList([guard.githubCommitUrl], 1, 500),
|
|
649
|
+
recordedAt: isoNow(now || ((_a = validation.normalized) === null || _a === void 0 ? void 0 : _a.recordedAt)),
|
|
650
|
+
metadata: {
|
|
651
|
+
channel: guard.channel || validation.channel,
|
|
652
|
+
status: guard.status,
|
|
653
|
+
passed: guard.passed,
|
|
654
|
+
commitFirstProtocol: guard.required ? 'commit_first_hotfix' : 'not_required',
|
|
655
|
+
commitFirstProtocolSatisfied: guard.required ? guard.passed === true : true,
|
|
656
|
+
liveHotfixBlockedUntilCommit: guard.required === true && guard.passed !== true,
|
|
657
|
+
managerMustCommitBeforeHotfix: guard.managerMustCommitBeforeHotfix,
|
|
658
|
+
sourceCommitSha: guard.sourceCommitSha,
|
|
659
|
+
githubCommitUrl: guard.githubCommitUrl,
|
|
660
|
+
githubCommitSha: guard.githubCommitSha,
|
|
661
|
+
gitCommitStatus: guard.gitCommitStatus,
|
|
662
|
+
gitPushStatus: guard.gitPushStatus,
|
|
663
|
+
blockers: guard.blockers,
|
|
664
|
+
nextCommands: guard.nextCommands,
|
|
665
|
+
requiredEvidence: guard.requiredEvidence
|
|
666
|
+
}
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
function hotfixDurabilityContractCandidates() {
|
|
670
|
+
var e_12, _a;
|
|
671
|
+
var sources = [];
|
|
672
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
673
|
+
sources[_i] = arguments[_i];
|
|
674
|
+
}
|
|
675
|
+
var result = [];
|
|
676
|
+
var seen = new Set();
|
|
677
|
+
var pushCandidate = function (value) {
|
|
678
|
+
var e_13, _a, e_14, _b;
|
|
679
|
+
var _c, _d;
|
|
680
|
+
if (Array.isArray(value)) {
|
|
681
|
+
try {
|
|
682
|
+
for (var value_2 = __values(value), value_2_1 = value_2.next(); !value_2_1.done; value_2_1 = value_2.next()) {
|
|
683
|
+
var entry = value_2_1.value;
|
|
684
|
+
pushCandidate(entry);
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
catch (e_13_1) { e_13 = { error: e_13_1 }; }
|
|
688
|
+
finally {
|
|
689
|
+
try {
|
|
690
|
+
if (value_2_1 && !value_2_1.done && (_a = value_2.return)) _a.call(value_2);
|
|
691
|
+
}
|
|
692
|
+
finally { if (e_13) throw e_13.error; }
|
|
693
|
+
}
|
|
694
|
+
return;
|
|
695
|
+
}
|
|
696
|
+
if (!value || typeof value !== 'object') {
|
|
697
|
+
return;
|
|
698
|
+
}
|
|
699
|
+
var nestedValues = [
|
|
700
|
+
value.hotfixDurabilityContract,
|
|
701
|
+
value.hotfix_durability_contract,
|
|
702
|
+
value.supportManagerHotfixDurabilityContract,
|
|
703
|
+
value.support_manager_hotfix_durability_contract,
|
|
704
|
+
value.managerRecoveryHotfixDurability,
|
|
705
|
+
value.manager_recovery_hotfix_durability,
|
|
706
|
+
(_c = value.supportV5RecoveryDirective) === null || _c === void 0 ? void 0 : _c.hotfixDurabilityContract,
|
|
707
|
+
(_d = value.supportV5RecoveryDirective) === null || _d === void 0 ? void 0 : _d.hotfix_durability_contract
|
|
708
|
+
].filter(Boolean);
|
|
709
|
+
if (nestedValues.length) {
|
|
710
|
+
try {
|
|
711
|
+
for (var nestedValues_2 = __values(nestedValues), nestedValues_2_1 = nestedValues_2.next(); !nestedValues_2_1.done; nestedValues_2_1 = nestedValues_2.next()) {
|
|
712
|
+
var nestedValue = nestedValues_2_1.value;
|
|
713
|
+
pushCandidate(nestedValue);
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
catch (e_14_1) { e_14 = { error: e_14_1 }; }
|
|
717
|
+
finally {
|
|
718
|
+
try {
|
|
719
|
+
if (nestedValues_2_1 && !nestedValues_2_1.done && (_b = nestedValues_2.return)) _b.call(nestedValues_2);
|
|
720
|
+
}
|
|
721
|
+
finally { if (e_14) throw e_14.error; }
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
var required = value.required === true || value.liveHotfixBlockedUntilCommit === true || value.live_hotfix_blocked_until_commit === true || value.commitProofPassed === true || value.commit_proof_passed === true;
|
|
725
|
+
if (!required) {
|
|
726
|
+
return;
|
|
727
|
+
}
|
|
728
|
+
var key = cleanText(value.contractId || value.contract_id || JSON.stringify({
|
|
729
|
+
status: value.status,
|
|
730
|
+
sha: value.sourceCommitSha || value.source_commit_sha,
|
|
731
|
+
url: value.githubCommitUrl || value.github_commit_url
|
|
732
|
+
}), 500);
|
|
733
|
+
if (seen.has(key)) {
|
|
734
|
+
return;
|
|
735
|
+
}
|
|
736
|
+
seen.add(key);
|
|
737
|
+
result.push(value);
|
|
738
|
+
};
|
|
739
|
+
try {
|
|
740
|
+
for (var sources_2 = __values(sources), sources_2_1 = sources_2.next(); !sources_2_1.done; sources_2_1 = sources_2.next()) {
|
|
741
|
+
var source = sources_2_1.value;
|
|
742
|
+
pushCandidate(source);
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
746
|
+
finally {
|
|
747
|
+
try {
|
|
748
|
+
if (sources_2_1 && !sources_2_1.done && (_a = sources_2.return)) _a.call(sources_2);
|
|
749
|
+
}
|
|
750
|
+
finally { if (e_12) throw e_12.error; }
|
|
751
|
+
}
|
|
752
|
+
return result;
|
|
753
|
+
}
|
|
754
|
+
function hotfixDurabilityContractGate(contractValue, now) {
|
|
755
|
+
var contract = (0, ai_runner_manager_policy_1.buildResolveIOAIManagerHotfixDurabilityContract)({
|
|
756
|
+
existing: contractValue,
|
|
757
|
+
evidence: contractValue.evidence || contractValue.hotfixEvidence || contractValue.hotfix_evidence,
|
|
758
|
+
action: contractValue.action,
|
|
759
|
+
reason: contractValue.reason,
|
|
760
|
+
now: now
|
|
761
|
+
});
|
|
762
|
+
if (!contract.required) {
|
|
763
|
+
return undefined;
|
|
764
|
+
}
|
|
765
|
+
var status = contract.liveHotfixBlockedUntilCommit
|
|
766
|
+
? 'blocked'
|
|
767
|
+
: contract.status === 'ready_for_continuation' || contract.status === 'ready_for_release_gate'
|
|
768
|
+
? 'pass'
|
|
769
|
+
: 'warn';
|
|
770
|
+
return {
|
|
771
|
+
key: 'hotfix_durability_contract',
|
|
772
|
+
label: 'Hotfix durability contract',
|
|
773
|
+
status: status,
|
|
774
|
+
reason: contract.liveHotfixBlockedUntilCommit
|
|
775
|
+
? "Manager hotfix is blocked until GitHub commit proof is recorded: ".concat(contract.missingCommitProofFields.join(', ') || 'sourceCommitSha, githubCommitUrl, gitCommitStatus=passed, gitPushStatus=passed')
|
|
776
|
+
: "Manager hotfix durability contract is ".concat(contract.status, "."),
|
|
777
|
+
evidenceRefs: cleanStringList([contract.githubCommitUrl], 1, 500),
|
|
778
|
+
recordedAt: isoNow(now || contract.updatedAt),
|
|
779
|
+
metadata: {
|
|
780
|
+
contractId: contract.contractId,
|
|
781
|
+
status: contract.status,
|
|
782
|
+
nextSafeAction: contract.nextSafeAction,
|
|
783
|
+
canPrepareHotfixPatch: contract.canPrepareHotfixPatch,
|
|
784
|
+
canHotfixBackend: contract.canHotfixBackend,
|
|
785
|
+
liveHotfixBlockedUntilCommit: contract.liveHotfixBlockedUntilCommit,
|
|
786
|
+
durabilityProtocol: contract.durabilityProtocol,
|
|
787
|
+
commitFirstProtocolRequired: contract.commitFirstProtocolRequired,
|
|
788
|
+
commitFirstProtocolSatisfied: contract.commitFirstProtocolSatisfied,
|
|
789
|
+
liveHotfixAllowed: contract.liveHotfixAllowed,
|
|
790
|
+
managerContinuationAllowed: contract.managerContinuationAllowed,
|
|
791
|
+
commitProofPassed: contract.commitProofPassed,
|
|
792
|
+
commitProofStatus: contract.commitProofStatus,
|
|
793
|
+
missingCommitProofFields: contract.missingCommitProofFields,
|
|
794
|
+
sourceCommitSha: contract.sourceCommitSha,
|
|
795
|
+
githubCommitUrl: contract.githubCommitUrl,
|
|
796
|
+
gitCommitStatus: contract.gitCommitStatus,
|
|
797
|
+
gitPushStatus: contract.gitPushStatus,
|
|
798
|
+
phaseOrder: contract.phaseOrder,
|
|
799
|
+
requiredFields: contract.requiredFields,
|
|
800
|
+
forbiddenActions: contract.forbiddenActions
|
|
801
|
+
}
|
|
802
|
+
};
|
|
803
|
+
}
|
|
804
|
+
function collectHotfixEvidenceEvents(sources, events, gates, now) {
|
|
805
|
+
var e_15, _a, e_16, _b;
|
|
806
|
+
var _c, _d;
|
|
807
|
+
try {
|
|
808
|
+
for (var _e = __values(hotfixDurabilityContractCandidates.apply(void 0, __spreadArray([], __read(sources), false))), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
809
|
+
var contract = _f.value;
|
|
810
|
+
var gate = hotfixDurabilityContractGate(contract, now);
|
|
811
|
+
if (gate) {
|
|
812
|
+
gates.push(gate);
|
|
813
|
+
pushEvent(events, {
|
|
814
|
+
type: 'log',
|
|
815
|
+
category: 'hotfix_durability_contract',
|
|
816
|
+
message: gate.reason,
|
|
817
|
+
artifactPaths: gate.evidenceRefs,
|
|
818
|
+
recordedAt: gate.recordedAt,
|
|
819
|
+
metadata: gate.metadata
|
|
820
|
+
});
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
catch (e_15_1) { e_15 = { error: e_15_1 }; }
|
|
825
|
+
finally {
|
|
826
|
+
try {
|
|
827
|
+
if (_f && !_f.done && (_a = _e.return)) _a.call(_e);
|
|
828
|
+
}
|
|
829
|
+
finally { if (e_15) throw e_15.error; }
|
|
830
|
+
}
|
|
831
|
+
try {
|
|
832
|
+
for (var _g = __values(hotfixEvidenceCandidates.apply(void 0, __spreadArray([], __read(sources), false))), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
833
|
+
var evidence = _h.value;
|
|
834
|
+
var validation = (0, ai_runner_manager_policy_1.validateResolveIOAIManagerHotfixEvidence)(evidence);
|
|
835
|
+
if (!validation.normalized && validation.status === 'missing') {
|
|
836
|
+
continue;
|
|
837
|
+
}
|
|
838
|
+
var artifactPaths = hotfixEvidenceArtifactPaths(evidence, validation.normalized);
|
|
839
|
+
pushEvent(events, {
|
|
840
|
+
type: 'hotfix',
|
|
841
|
+
category: validation.channel || 'hotfix',
|
|
842
|
+
message: validation.valid
|
|
843
|
+
? "Hotfix evidence recorded for ".concat(validation.channel, ".")
|
|
844
|
+
: "Incomplete hotfix evidence for ".concat(validation.channel || 'unknown channel', "."),
|
|
845
|
+
artifactPaths: artifactPaths,
|
|
846
|
+
recordedAt: ((_c = validation.normalized) === null || _c === void 0 ? void 0 : _c.recordedAt) || eventDate(evidence),
|
|
847
|
+
metadata: {
|
|
848
|
+
status: validation.status,
|
|
849
|
+
nextAction: validation.nextAction,
|
|
850
|
+
fullDeployAllowed: validation.fullDeployAllowed,
|
|
851
|
+
fullDeployBlocked: validation.fullDeployBlocked,
|
|
852
|
+
hotfixSatisfied: validation.hotfixSatisfied,
|
|
853
|
+
blockers: validation.blockers,
|
|
854
|
+
githubCommitGuard: validation.githubCommitGuard,
|
|
855
|
+
target: (_d = validation.normalized) === null || _d === void 0 ? void 0 : _d.target
|
|
856
|
+
}
|
|
857
|
+
});
|
|
858
|
+
var gate = hotfixEvidenceGate(evidence, now);
|
|
859
|
+
if (gate) {
|
|
860
|
+
gates.push(gate);
|
|
861
|
+
}
|
|
862
|
+
var commitProofGate = hotfixCommitProofGate(evidence, now);
|
|
863
|
+
if (commitProofGate) {
|
|
864
|
+
gates.push(commitProofGate);
|
|
865
|
+
pushEvent(events, {
|
|
866
|
+
type: 'log',
|
|
867
|
+
category: 'hotfix_commit_proof',
|
|
868
|
+
message: commitProofGate.reason,
|
|
869
|
+
artifactPaths: commitProofGate.evidenceRefs,
|
|
870
|
+
recordedAt: commitProofGate.recordedAt,
|
|
871
|
+
metadata: commitProofGate.metadata
|
|
872
|
+
});
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
catch (e_16_1) { e_16 = { error: e_16_1 }; }
|
|
877
|
+
finally {
|
|
878
|
+
try {
|
|
879
|
+
if (_h && !_h.done && (_b = _g.return)) _b.call(_g);
|
|
880
|
+
}
|
|
881
|
+
finally { if (e_16) throw e_16.error; }
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
function hotfixDurabilityMetadata(gates) {
|
|
885
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12;
|
|
886
|
+
var hotfixGate = gates.find(function (gate) { return gate.key === 'hotfix_evidence'; });
|
|
887
|
+
var commitGate = gates.find(function (gate) { return gate.key === 'hotfix_commit_proof'; });
|
|
888
|
+
var durabilityGate = gates.find(function (gate) { return gate.key === 'hotfix_durability_contract'; });
|
|
889
|
+
if (!hotfixGate && !commitGate && !durabilityGate) {
|
|
890
|
+
return undefined;
|
|
891
|
+
}
|
|
892
|
+
var commitBlocked = (!!commitGate && (commitGate.status === 'blocked' || commitGate.status === 'fail'))
|
|
893
|
+
|| ((_a = durabilityGate === null || durabilityGate === void 0 ? void 0 : durabilityGate.metadata) === null || _a === void 0 ? void 0 : _a.liveHotfixBlockedUntilCommit) === true;
|
|
894
|
+
return {
|
|
895
|
+
durabilityStatus: cleanText((_b = durabilityGate === null || durabilityGate === void 0 ? void 0 : durabilityGate.metadata) === null || _b === void 0 ? void 0 : _b.status, 80),
|
|
896
|
+
durabilityGateStatus: cleanText(durabilityGate === null || durabilityGate === void 0 ? void 0 : durabilityGate.status, 80),
|
|
897
|
+
canPrepareHotfixPatch: ((_c = durabilityGate === null || durabilityGate === void 0 ? void 0 : durabilityGate.metadata) === null || _c === void 0 ? void 0 : _c.canPrepareHotfixPatch) === true,
|
|
898
|
+
canHotfixBackend: ((_d = durabilityGate === null || durabilityGate === void 0 ? void 0 : durabilityGate.metadata) === null || _d === void 0 ? void 0 : _d.canHotfixBackend) === true,
|
|
899
|
+
liveHotfixBlockedUntilCommit: ((_e = durabilityGate === null || durabilityGate === void 0 ? void 0 : durabilityGate.metadata) === null || _e === void 0 ? void 0 : _e.liveHotfixBlockedUntilCommit) === true,
|
|
900
|
+
durabilityProtocol: cleanText((_f = durabilityGate === null || durabilityGate === void 0 ? void 0 : durabilityGate.metadata) === null || _f === void 0 ? void 0 : _f.durabilityProtocol, 120),
|
|
901
|
+
commitFirstProtocolRequired: ((_g = durabilityGate === null || durabilityGate === void 0 ? void 0 : durabilityGate.metadata) === null || _g === void 0 ? void 0 : _g.commitFirstProtocolRequired) === true,
|
|
902
|
+
commitFirstProtocolSatisfied: ((_h = durabilityGate === null || durabilityGate === void 0 ? void 0 : durabilityGate.metadata) === null || _h === void 0 ? void 0 : _h.commitFirstProtocolSatisfied) === true || ((_j = commitGate === null || commitGate === void 0 ? void 0 : commitGate.metadata) === null || _j === void 0 ? void 0 : _j.commitFirstProtocolSatisfied) === true,
|
|
903
|
+
liveHotfixAllowed: ((_k = durabilityGate === null || durabilityGate === void 0 ? void 0 : durabilityGate.metadata) === null || _k === void 0 ? void 0 : _k.liveHotfixAllowed) === true || (((_l = hotfixGate === null || hotfixGate === void 0 ? void 0 : hotfixGate.metadata) === null || _l === void 0 ? void 0 : _l.hotfixSatisfied) === true && ((_m = commitGate === null || commitGate === void 0 ? void 0 : commitGate.metadata) === null || _m === void 0 ? void 0 : _m.commitFirstProtocolSatisfied) === true),
|
|
904
|
+
managerContinuationAllowed: ((_o = durabilityGate === null || durabilityGate === void 0 ? void 0 : durabilityGate.metadata) === null || _o === void 0 ? void 0 : _o.managerContinuationAllowed) === true,
|
|
905
|
+
hotfixEvidenceStatus: cleanText(hotfixGate === null || hotfixGate === void 0 ? void 0 : hotfixGate.status, 80),
|
|
906
|
+
hotfixSatisfied: ((_p = hotfixGate === null || hotfixGate === void 0 ? void 0 : hotfixGate.metadata) === null || _p === void 0 ? void 0 : _p.hotfixSatisfied) === true,
|
|
907
|
+
fullDeployBlocked: ((_q = hotfixGate === null || hotfixGate === void 0 ? void 0 : hotfixGate.metadata) === null || _q === void 0 ? void 0 : _q.fullDeployBlocked) === true,
|
|
908
|
+
fullDeployAllowed: ((_r = hotfixGate === null || hotfixGate === void 0 ? void 0 : hotfixGate.metadata) === null || _r === void 0 ? void 0 : _r.fullDeployAllowed) === true,
|
|
909
|
+
commitProofRequired: !!commitGate || !!durabilityGate,
|
|
910
|
+
commitProofStatus: cleanText((commitGate === null || commitGate === void 0 ? void 0 : commitGate.status) || ((_s = durabilityGate === null || durabilityGate === void 0 ? void 0 : durabilityGate.metadata) === null || _s === void 0 ? void 0 : _s.commitProofStatus), 80),
|
|
911
|
+
commitProofPassed: ((_t = commitGate === null || commitGate === void 0 ? void 0 : commitGate.metadata) === null || _t === void 0 ? void 0 : _t.passed) === true || ((_u = durabilityGate === null || durabilityGate === void 0 ? void 0 : durabilityGate.metadata) === null || _u === void 0 ? void 0 : _u.commitProofPassed) === true,
|
|
912
|
+
commitBlocked: commitBlocked,
|
|
913
|
+
channel: cleanText(((_v = commitGate === null || commitGate === void 0 ? void 0 : commitGate.metadata) === null || _v === void 0 ? void 0 : _v.channel) || ((_w = hotfixGate === null || hotfixGate === void 0 ? void 0 : hotfixGate.metadata) === null || _w === void 0 ? void 0 : _w.channel), 120),
|
|
914
|
+
sourceCommitSha: cleanText(((_x = commitGate === null || commitGate === void 0 ? void 0 : commitGate.metadata) === null || _x === void 0 ? void 0 : _x.sourceCommitSha) || ((_y = durabilityGate === null || durabilityGate === void 0 ? void 0 : durabilityGate.metadata) === null || _y === void 0 ? void 0 : _y.sourceCommitSha), 200),
|
|
915
|
+
githubCommitUrl: cleanText(((_z = commitGate === null || commitGate === void 0 ? void 0 : commitGate.metadata) === null || _z === void 0 ? void 0 : _z.githubCommitUrl) || ((_0 = durabilityGate === null || durabilityGate === void 0 ? void 0 : durabilityGate.metadata) === null || _0 === void 0 ? void 0 : _0.githubCommitUrl), 500),
|
|
916
|
+
gitCommitStatus: cleanText(((_1 = commitGate === null || commitGate === void 0 ? void 0 : commitGate.metadata) === null || _1 === void 0 ? void 0 : _1.gitCommitStatus) || ((_2 = durabilityGate === null || durabilityGate === void 0 ? void 0 : durabilityGate.metadata) === null || _2 === void 0 ? void 0 : _2.gitCommitStatus), 120),
|
|
917
|
+
gitPushStatus: cleanText(((_3 = commitGate === null || commitGate === void 0 ? void 0 : commitGate.metadata) === null || _3 === void 0 ? void 0 : _3.gitPushStatus) || ((_4 = durabilityGate === null || durabilityGate === void 0 ? void 0 : durabilityGate.metadata) === null || _4 === void 0 ? void 0 : _4.gitPushStatus), 120),
|
|
918
|
+
blockers: cleanStringList(__spreadArray(__spreadArray(__spreadArray([], __read(asArray((_5 = durabilityGate === null || durabilityGate === void 0 ? void 0 : durabilityGate.metadata) === null || _5 === void 0 ? void 0 : _5.missingCommitProofFields)), false), __read(asArray((_6 = commitGate === null || commitGate === void 0 ? void 0 : commitGate.metadata) === null || _6 === void 0 ? void 0 : _6.blockers)), false), __read(asArray((_7 = hotfixGate === null || hotfixGate === void 0 ? void 0 : hotfixGate.metadata) === null || _7 === void 0 ? void 0 : _7.blockers)), false), 20, 500),
|
|
919
|
+
requiredEvidence: cleanStringList(((_8 = commitGate === null || commitGate === void 0 ? void 0 : commitGate.metadata) === null || _8 === void 0 ? void 0 : _8.requiredEvidence) || ((_9 = durabilityGate === null || durabilityGate === void 0 ? void 0 : durabilityGate.metadata) === null || _9 === void 0 ? void 0 : _9.requiredFields), 20, 500),
|
|
920
|
+
nextCommands: cleanStringList((_10 = commitGate === null || commitGate === void 0 ? void 0 : commitGate.metadata) === null || _10 === void 0 ? void 0 : _10.nextCommands, 20, 240),
|
|
921
|
+
nextAction: commitBlocked
|
|
922
|
+
? cleanText((_11 = durabilityGate === null || durabilityGate === void 0 ? void 0 : durabilityGate.metadata) === null || _11 === void 0 ? void 0 : _11.nextSafeAction, 200) || 'Commit and push the hotfix to GitHub, record sourceCommitSha/githubCommitUrl/gitCommitStatus/gitPushStatus, then rerun the smallest verification gate.'
|
|
923
|
+
: cleanText((_12 = hotfixGate === null || hotfixGate === void 0 ? void 0 : hotfixGate.metadata) === null || _12 === void 0 ? void 0 : _12.nextAction, 1000)
|
|
924
|
+
};
|
|
925
|
+
}
|
|
926
|
+
function collectUsageEvents(entries, events) {
|
|
927
|
+
var e_17, _a;
|
|
928
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
929
|
+
if (!entries.length) {
|
|
930
|
+
return undefined;
|
|
931
|
+
}
|
|
932
|
+
var normalizedEntries = (0, ai_run_evidence_1.normalizeOpenAIUsageRowsForCosting)(entries);
|
|
933
|
+
try {
|
|
934
|
+
for (var normalizedEntries_1 = __values(normalizedEntries), normalizedEntries_1_1 = normalizedEntries_1.next(); !normalizedEntries_1_1.done; normalizedEntries_1_1 = normalizedEntries_1.next()) {
|
|
935
|
+
var entry = normalizedEntries_1_1.value;
|
|
936
|
+
pushEvent(events, {
|
|
937
|
+
type: 'usage',
|
|
938
|
+
category: cleanText(entry.category || entry.kind || entry.phase, 160) || 'usage',
|
|
939
|
+
message: cleanText(entry.summary || entry.description || entry.model || 'Model usage recorded.', 800),
|
|
940
|
+
recordedAt: eventDate(entry),
|
|
941
|
+
metadata: {
|
|
942
|
+
model: entry.model,
|
|
943
|
+
inputTokens: (_b = entry.inputTokens) !== null && _b !== void 0 ? _b : entry.input_tokens,
|
|
944
|
+
outputTokens: (_c = entry.outputTokens) !== null && _c !== void 0 ? _c : entry.output_tokens,
|
|
945
|
+
totalTokens: (_d = entry.totalTokens) !== null && _d !== void 0 ? _d : entry.total_tokens,
|
|
946
|
+
estimatedUsd: (_e = entry.estimatedUsd) !== null && _e !== void 0 ? _e : entry.cost_estimate,
|
|
947
|
+
usageSource: (_f = entry.usage_source) !== null && _f !== void 0 ? _f : entry.usageSource,
|
|
948
|
+
usageSurface: (_g = entry.usage_surface) !== null && _g !== void 0 ? _g : entry.usageSurface,
|
|
949
|
+
usagePhase: (_h = entry.usage_phase) !== null && _h !== void 0 ? _h : entry.usagePhase,
|
|
950
|
+
costBasis: (_j = entry.cost_basis) !== null && _j !== void 0 ? _j : entry.costBasis,
|
|
951
|
+
isManual: (_k = entry.is_manual) !== null && _k !== void 0 ? _k : entry.isManual,
|
|
952
|
+
isUntracked: (_l = entry.is_untracked) !== null && _l !== void 0 ? _l : entry.isUntracked,
|
|
953
|
+
untrackedReason: (_m = entry.untracked_reason) !== null && _m !== void 0 ? _m : entry.untrackedReason
|
|
954
|
+
}
|
|
955
|
+
});
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
catch (e_17_1) { e_17 = { error: e_17_1 }; }
|
|
959
|
+
finally {
|
|
960
|
+
try {
|
|
961
|
+
if (normalizedEntries_1_1 && !normalizedEntries_1_1.done && (_a = normalizedEntries_1.return)) _a.call(normalizedEntries_1);
|
|
962
|
+
}
|
|
963
|
+
finally { if (e_17) throw e_17.error; }
|
|
964
|
+
}
|
|
965
|
+
return (0, ai_run_evidence_1.buildAIRunCost)(entries);
|
|
966
|
+
}
|
|
967
|
+
function costObservabilityGate(cost, source, now) {
|
|
968
|
+
var manualEstimatedUsd = Number((cost === null || cost === void 0 ? void 0 : cost.manualEstimatedUsd) || 0);
|
|
969
|
+
var untrackedEstimatedUsd = Number((cost === null || cost === void 0 ? void 0 : cost.untrackedEstimatedUsd) || 0);
|
|
970
|
+
var warnings = cleanStringList(cost === null || cost === void 0 ? void 0 : cost.untrackedWarnings, 20, 500);
|
|
971
|
+
var manualSources = Object.entries((cost === null || cost === void 0 ? void 0 : cost.sources) || {})
|
|
972
|
+
.filter(function (_a) {
|
|
973
|
+
var _b = __read(_a, 2), value = _b[1];
|
|
974
|
+
return Number(value.manualCount || 0) > 0;
|
|
975
|
+
})
|
|
976
|
+
.map(function (_a) {
|
|
977
|
+
var _b = __read(_a, 1), key = _b[0];
|
|
978
|
+
return key;
|
|
979
|
+
});
|
|
980
|
+
var untrackedSources = Object.entries((cost === null || cost === void 0 ? void 0 : cost.sources) || {})
|
|
981
|
+
.filter(function (_a) {
|
|
982
|
+
var _b = __read(_a, 2), value = _b[1];
|
|
983
|
+
return Number(value.untrackedCount || 0) > 0;
|
|
984
|
+
})
|
|
985
|
+
.map(function (_a) {
|
|
986
|
+
var _b = __read(_a, 1), key = _b[0];
|
|
987
|
+
return key;
|
|
988
|
+
});
|
|
989
|
+
var missingLedger = !cost;
|
|
990
|
+
var externalCodexMonitorUsed = manualEstimatedUsd > 0
|
|
991
|
+
|| untrackedEstimatedUsd > 0
|
|
992
|
+
|| manualSources.some(function (sourceKey) { return /codex|manual/i.test(sourceKey); })
|
|
993
|
+
|| warnings.some(function (warning) { return /codex|sidecar|monitor/i.test(warning); });
|
|
994
|
+
var status = missingLedger
|
|
995
|
+
? 'skipped'
|
|
996
|
+
: (manualEstimatedUsd > 0 || untrackedEstimatedUsd > 0 || warnings.length ? 'warn' : 'pass');
|
|
997
|
+
return {
|
|
998
|
+
key: 'cost_observability',
|
|
999
|
+
label: 'Cost observability',
|
|
1000
|
+
status: status,
|
|
1001
|
+
reason: missingLedger
|
|
1002
|
+
? 'No usage ledger was supplied for this run, so cost per accepted run cannot be fully evaluated.'
|
|
1003
|
+
: status === 'warn'
|
|
1004
|
+
? "Runner cost includes manual or untracked usage: manual=$".concat(manualEstimatedUsd.toFixed(2), ", untracked=$").concat(untrackedEstimatedUsd.toFixed(2), ".")
|
|
1005
|
+
: 'Runner usage is tracked in the unified cost ledger.',
|
|
1006
|
+
evidenceRefs: warnings,
|
|
1007
|
+
recordedAt: isoNow(now),
|
|
1008
|
+
metadata: {
|
|
1009
|
+
source: source,
|
|
1010
|
+
missingLedger: missingLedger,
|
|
1011
|
+
estimatedUsd: Number((cost === null || cost === void 0 ? void 0 : cost.estimatedUsd) || 0),
|
|
1012
|
+
manualEstimatedUsd: manualEstimatedUsd,
|
|
1013
|
+
untrackedEstimatedUsd: untrackedEstimatedUsd,
|
|
1014
|
+
externalCodexMonitorUsed: externalCodexMonitorUsed,
|
|
1015
|
+
manualSources: manualSources,
|
|
1016
|
+
untrackedSources: untrackedSources,
|
|
1017
|
+
models: cleanStringList(cost === null || cost === void 0 ? void 0 : cost.models, 40, 120),
|
|
1018
|
+
categories: Object.keys((cost === null || cost === void 0 ? void 0 : cost.categories) || {}).slice(0, 40),
|
|
1019
|
+
surfaces: Object.keys((cost === null || cost === void 0 ? void 0 : cost.surfaces) || {}).slice(0, 40),
|
|
1020
|
+
warnings: warnings
|
|
1021
|
+
}
|
|
1022
|
+
};
|
|
1023
|
+
}
|
|
1024
|
+
function costObservabilityMetadata(gate) {
|
|
1025
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
1026
|
+
if (!gate) {
|
|
1027
|
+
return undefined;
|
|
1028
|
+
}
|
|
1029
|
+
return {
|
|
1030
|
+
status: gate.status,
|
|
1031
|
+
missingLedger: ((_a = gate.metadata) === null || _a === void 0 ? void 0 : _a.missingLedger) === true,
|
|
1032
|
+
estimatedUsd: Number(((_b = gate.metadata) === null || _b === void 0 ? void 0 : _b.estimatedUsd) || 0),
|
|
1033
|
+
manualEstimatedUsd: Number(((_c = gate.metadata) === null || _c === void 0 ? void 0 : _c.manualEstimatedUsd) || 0),
|
|
1034
|
+
untrackedEstimatedUsd: Number(((_d = gate.metadata) === null || _d === void 0 ? void 0 : _d.untrackedEstimatedUsd) || 0),
|
|
1035
|
+
externalCodexMonitorUsed: ((_e = gate.metadata) === null || _e === void 0 ? void 0 : _e.externalCodexMonitorUsed) === true,
|
|
1036
|
+
manualSources: cleanStringList((_f = gate.metadata) === null || _f === void 0 ? void 0 : _f.manualSources, 20, 120),
|
|
1037
|
+
untrackedSources: cleanStringList((_g = gate.metadata) === null || _g === void 0 ? void 0 : _g.untrackedSources, 20, 120),
|
|
1038
|
+
models: cleanStringList((_h = gate.metadata) === null || _h === void 0 ? void 0 : _h.models, 40, 120),
|
|
1039
|
+
categories: cleanStringList((_j = gate.metadata) === null || _j === void 0 ? void 0 : _j.categories, 40, 120),
|
|
1040
|
+
surfaces: cleanStringList((_k = gate.metadata) === null || _k === void 0 ? void 0 : _k.surfaces, 40, 120),
|
|
1041
|
+
warnings: cleanStringList((_l = gate.metadata) === null || _l === void 0 ? void 0 : _l.warnings, 20, 500),
|
|
1042
|
+
nextAction: gate.status === 'warn'
|
|
1043
|
+
? 'Record manual Codex sidecar usage in the unified ledger and replace external monitoring with a validated next-action contract.'
|
|
1044
|
+
: gate.status === 'skipped'
|
|
1045
|
+
? 'Attach runner, assistant, manual Codex, retry, and deploy usage rows before comparing cost per accepted run.'
|
|
1046
|
+
: 'Continue tracking cost in the unified ledger.'
|
|
1047
|
+
};
|
|
1048
|
+
}
|
|
1049
|
+
function collectCommitEvents(commits, events) {
|
|
1050
|
+
var e_18, _a;
|
|
1051
|
+
try {
|
|
1052
|
+
for (var _b = __values(commits.slice(0, 80)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1053
|
+
var commit = _c.value;
|
|
1054
|
+
pushEvent(events, {
|
|
1055
|
+
type: 'git_commit',
|
|
1056
|
+
message: cleanText(commit.message || commit.subject || commit.title || commit.hash || commit.sha, 1200),
|
|
1057
|
+
recordedAt: eventDate(commit),
|
|
1058
|
+
metadata: {
|
|
1059
|
+
sha: commit.sha || commit.hash,
|
|
1060
|
+
branch: commit.branch,
|
|
1061
|
+
author: commit.author
|
|
1062
|
+
}
|
|
1063
|
+
});
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
catch (e_18_1) { e_18 = { error: e_18_1 }; }
|
|
1067
|
+
finally {
|
|
1068
|
+
try {
|
|
1069
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1070
|
+
}
|
|
1071
|
+
finally { if (e_18) throw e_18.error; }
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
function statusFromBoolean(value, fallback) {
|
|
1075
|
+
if (value === true) {
|
|
1076
|
+
return 'pass';
|
|
1077
|
+
}
|
|
1078
|
+
if (value === false) {
|
|
1079
|
+
return 'fail';
|
|
1080
|
+
}
|
|
1081
|
+
return fallback;
|
|
1082
|
+
}
|
|
1083
|
+
function collectArtifacts(evidence) {
|
|
1084
|
+
var e_19, _a, e_20, _b, e_21, _c;
|
|
1085
|
+
var artifacts = [];
|
|
1086
|
+
try {
|
|
1087
|
+
for (var _d = __values(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.artifacts)), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
1088
|
+
var entry = _e.value;
|
|
1089
|
+
artifacts.push({
|
|
1090
|
+
type: entry.type || 'other',
|
|
1091
|
+
path: cleanText(entry.path || entry.file || entry.artifactPath, 500),
|
|
1092
|
+
url: cleanText(entry.url, 500),
|
|
1093
|
+
title: cleanText(entry.title || entry.name, 300),
|
|
1094
|
+
caption: cleanText(entry.caption || entry.message, 800),
|
|
1095
|
+
metadata: entry.metadata
|
|
1096
|
+
});
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
catch (e_19_1) { e_19 = { error: e_19_1 }; }
|
|
1100
|
+
finally {
|
|
1101
|
+
try {
|
|
1102
|
+
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
1103
|
+
}
|
|
1104
|
+
finally { if (e_19) throw e_19.error; }
|
|
1105
|
+
}
|
|
1106
|
+
var screenshots = asArray((evidence === null || evidence === void 0 ? void 0 : evidence.screenshots) || (evidence === null || evidence === void 0 ? void 0 : evidence.qaScreenshots) || (evidence === null || evidence === void 0 ? void 0 : evidence.browserScreenshots));
|
|
1107
|
+
try {
|
|
1108
|
+
for (var _f = __values(screenshots.slice(0, 40)), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
1109
|
+
var screenshot = _g.value;
|
|
1110
|
+
if (typeof screenshot === 'string') {
|
|
1111
|
+
artifacts.push({ type: 'screenshot', path: screenshot });
|
|
1112
|
+
}
|
|
1113
|
+
else {
|
|
1114
|
+
artifacts.push({
|
|
1115
|
+
type: 'screenshot',
|
|
1116
|
+
path: cleanText(screenshot.path || screenshot.file, 500),
|
|
1117
|
+
url: cleanText(screenshot.url, 500),
|
|
1118
|
+
title: cleanText(screenshot.title || screenshot.route, 300),
|
|
1119
|
+
caption: cleanText(screenshot.caption || screenshot.message, 800),
|
|
1120
|
+
metadata: screenshot.metadata
|
|
1121
|
+
});
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
catch (e_20_1) { e_20 = { error: e_20_1 }; }
|
|
1126
|
+
finally {
|
|
1127
|
+
try {
|
|
1128
|
+
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
1129
|
+
}
|
|
1130
|
+
finally { if (e_20) throw e_20.error; }
|
|
1131
|
+
}
|
|
1132
|
+
var artifactRefs = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.artifactPaths)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.artifact_paths)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.runnerEvidenceArtifacts)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.runner_evidence_artifacts)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.supportQaArtifacts)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.support_qa_artifacts)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.qa_artifacts)), false);
|
|
1133
|
+
try {
|
|
1134
|
+
for (var _h = __values(artifactRefs.slice(0, 60)), _j = _h.next(); !_j.done; _j = _h.next()) {
|
|
1135
|
+
var entry = _j.value;
|
|
1136
|
+
if (typeof entry === 'string') {
|
|
1137
|
+
artifacts.push({ type: 'other', path: cleanText(entry, 500) });
|
|
1138
|
+
}
|
|
1139
|
+
else if (entry && typeof entry === 'object') {
|
|
1140
|
+
artifacts.push({
|
|
1141
|
+
type: entry.type || 'other',
|
|
1142
|
+
path: cleanText(entry.path || entry.file || entry.artifactPath || entry.artifact_path, 500),
|
|
1143
|
+
url: cleanText(entry.url, 500),
|
|
1144
|
+
title: cleanText(entry.title || entry.name || entry.label, 300),
|
|
1145
|
+
caption: cleanText(entry.caption || entry.message || entry.summary, 800),
|
|
1146
|
+
metadata: entry.metadata
|
|
1147
|
+
});
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
catch (e_21_1) { e_21 = { error: e_21_1 }; }
|
|
1152
|
+
finally {
|
|
1153
|
+
try {
|
|
1154
|
+
if (_j && !_j.done && (_c = _h.return)) _c.call(_h);
|
|
1155
|
+
}
|
|
1156
|
+
finally { if (e_21) throw e_21.error; }
|
|
1157
|
+
}
|
|
1158
|
+
return artifacts;
|
|
1159
|
+
}
|
|
1160
|
+
function collectInfraChecks(evidence) {
|
|
1161
|
+
var e_22, _a;
|
|
1162
|
+
var _b;
|
|
1163
|
+
var checks = [];
|
|
1164
|
+
try {
|
|
1165
|
+
for (var _c = __values(asArray((evidence === null || evidence === void 0 ? void 0 : evidence.infraChecks) || (evidence === null || evidence === void 0 ? void 0 : evidence.preflightChecks))), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
1166
|
+
var entry = _d.value;
|
|
1167
|
+
checks.push({
|
|
1168
|
+
name: cleanText(entry.name || entry.check || entry.key, 160) || 'infra_check',
|
|
1169
|
+
status: entry.status || statusFromBoolean(entry.passed),
|
|
1170
|
+
message: cleanText(entry.message || entry.error || entry.reason, 1000),
|
|
1171
|
+
path: cleanText(entry.path, 500),
|
|
1172
|
+
durationMs: Number((_b = entry.durationMs) !== null && _b !== void 0 ? _b : entry.duration_ms) || undefined,
|
|
1173
|
+
metadata: entry.metadata,
|
|
1174
|
+
checkedAt: eventDate(entry)
|
|
1175
|
+
});
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
catch (e_22_1) { e_22 = { error: e_22_1 }; }
|
|
1179
|
+
finally {
|
|
1180
|
+
try {
|
|
1181
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
1182
|
+
}
|
|
1183
|
+
finally { if (e_22) throw e_22.error; }
|
|
1184
|
+
}
|
|
1185
|
+
if (evidence === null || evidence === void 0 ? void 0 : evidence.preflightStatus) {
|
|
1186
|
+
checks.push({
|
|
1187
|
+
name: 'qa_preflight',
|
|
1188
|
+
status: evidence.preflightStatus,
|
|
1189
|
+
message: cleanText(evidence.preflightMessage || evidence.preflightReason, 1000),
|
|
1190
|
+
path: cleanText(evidence.preflightArtifactPath || evidence.preflightPath, 500)
|
|
1191
|
+
});
|
|
1192
|
+
}
|
|
1193
|
+
return checks;
|
|
1194
|
+
}
|
|
1195
|
+
function collectCompileResult(evidence) {
|
|
1196
|
+
var _a, _b, _c;
|
|
1197
|
+
var build = (evidence === null || evidence === void 0 ? void 0 : evidence.compile) || (evidence === null || evidence === void 0 ? void 0 : evidence.build) || (evidence === null || evidence === void 0 ? void 0 : evidence.buildEvidence) || (evidence === null || evidence === void 0 ? void 0 : evidence.buildResult);
|
|
1198
|
+
if (!build && (evidence === null || evidence === void 0 ? void 0 : evidence.compileStatus) === undefined && (evidence === null || evidence === void 0 ? void 0 : evidence.buildStatus) === undefined) {
|
|
1199
|
+
return undefined;
|
|
1200
|
+
}
|
|
1201
|
+
var status = (build === null || build === void 0 ? void 0 : build.status)
|
|
1202
|
+
|| (evidence === null || evidence === void 0 ? void 0 : evidence.compileStatus)
|
|
1203
|
+
|| (evidence === null || evidence === void 0 ? void 0 : evidence.buildStatus)
|
|
1204
|
+
|| statusFromBoolean((_b = (_a = build === null || build === void 0 ? void 0 : build.passed) !== null && _a !== void 0 ? _a : build === null || build === void 0 ? void 0 : build.allExpectedPassed) !== null && _b !== void 0 ? _b : evidence === null || evidence === void 0 ? void 0 : evidence.buildPassed);
|
|
1205
|
+
return {
|
|
1206
|
+
status: status,
|
|
1207
|
+
command: cleanText((build === null || build === void 0 ? void 0 : build.command) || (evidence === null || evidence === void 0 ? void 0 : evidence.buildCommand), 500),
|
|
1208
|
+
artifactPath: cleanText((build === null || build === void 0 ? void 0 : build.artifactPath) || (build === null || build === void 0 ? void 0 : build.logPath) || (evidence === null || evidence === void 0 ? void 0 : evidence.buildLogPath), 500),
|
|
1209
|
+
message: cleanText((build === null || build === void 0 ? void 0 : build.message) || (build === null || build === void 0 ? void 0 : build.error) || (evidence === null || evidence === void 0 ? void 0 : evidence.buildMessage), 1000),
|
|
1210
|
+
durationMs: Number((_c = build === null || build === void 0 ? void 0 : build.durationMs) !== null && _c !== void 0 ? _c : build === null || build === void 0 ? void 0 : build.duration_ms) || undefined,
|
|
1211
|
+
staleEvidence: (build === null || build === void 0 ? void 0 : build.staleEvidence) === true || (evidence === null || evidence === void 0 ? void 0 : evidence.staleBuildEvidence) === true,
|
|
1212
|
+
recordedAt: eventDate(build || evidence || {})
|
|
1213
|
+
};
|
|
1214
|
+
}
|
|
1215
|
+
function collectRouteProbes(evidence) {
|
|
1216
|
+
var e_23, _a, e_24, _b;
|
|
1217
|
+
var probes = [];
|
|
1218
|
+
var rows = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.routeProbes)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.route_probes)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.routes)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.browserRoutes)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.browser_routes)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.workflowProbes)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.workflow_probes)), false);
|
|
1219
|
+
var directProbe = plainObject((evidence === null || evidence === void 0 ? void 0 : evidence.routeProbe) || (evidence === null || evidence === void 0 ? void 0 : evidence.route_probe) || (evidence === null || evidence === void 0 ? void 0 : evidence.workflowProbe) || (evidence === null || evidence === void 0 ? void 0 : evidence.workflow_probe));
|
|
1220
|
+
if (Object.keys(directProbe).length) {
|
|
1221
|
+
rows.push(directProbe);
|
|
1222
|
+
}
|
|
1223
|
+
try {
|
|
1224
|
+
for (var rows_1 = __values(rows), rows_1_1 = rows_1.next(); !rows_1_1.done; rows_1_1 = rows_1.next()) {
|
|
1225
|
+
var entry = rows_1_1.value;
|
|
1226
|
+
probes.push({
|
|
1227
|
+
route: cleanText(entry.route || entry.path || entry.url, 500) || '/',
|
|
1228
|
+
status: entry.status || statusFromBoolean(entry.passed),
|
|
1229
|
+
screenshot: cleanText(entry.screenshot || entry.screenshotPath, 500),
|
|
1230
|
+
caption: cleanText(entry.caption || entry.message, 1000),
|
|
1231
|
+
shellOnly: entry.shellOnly === true,
|
|
1232
|
+
authenticated: entry.authenticated === true,
|
|
1233
|
+
consoleErrors: asArray(entry.consoleErrors),
|
|
1234
|
+
networkErrors: asArray(entry.networkErrors),
|
|
1235
|
+
message: cleanText(entry.message || entry.error, 1000),
|
|
1236
|
+
recordedAt: eventDate(entry)
|
|
1237
|
+
});
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
catch (e_23_1) { e_23 = { error: e_23_1 }; }
|
|
1241
|
+
finally {
|
|
1242
|
+
try {
|
|
1243
|
+
if (rows_1_1 && !rows_1_1.done && (_a = rows_1.return)) _a.call(rows_1);
|
|
1244
|
+
}
|
|
1245
|
+
finally { if (e_23) throw e_23.error; }
|
|
1246
|
+
}
|
|
1247
|
+
var screenshots = asArray((evidence === null || evidence === void 0 ? void 0 : evidence.screenshots) || (evidence === null || evidence === void 0 ? void 0 : evidence.qaScreenshots) || (evidence === null || evidence === void 0 ? void 0 : evidence.browserScreenshots));
|
|
1248
|
+
try {
|
|
1249
|
+
for (var _c = __values(screenshots.slice(0, 20)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
1250
|
+
var screenshot = _d.value;
|
|
1251
|
+
if (typeof screenshot === 'string') {
|
|
1252
|
+
probes.push({ route: '/', status: 'pass', screenshot: screenshot, caption: 'Historical browser screenshot recorded.' });
|
|
1253
|
+
}
|
|
1254
|
+
else if (screenshot.route || screenshot.path || screenshot.url || screenshot.screenshot || screenshot.file) {
|
|
1255
|
+
probes.push({
|
|
1256
|
+
route: cleanText(screenshot.route || screenshot.url || screenshot.path, 500) || '/',
|
|
1257
|
+
status: screenshot.status || statusFromBoolean(screenshot.passed, 'pass'),
|
|
1258
|
+
screenshot: cleanText(screenshot.screenshot || screenshot.screenshotPath || screenshot.file || screenshot.path, 500),
|
|
1259
|
+
caption: cleanText(screenshot.caption || screenshot.message, 1000),
|
|
1260
|
+
shellOnly: screenshot.shellOnly === true,
|
|
1261
|
+
authenticated: screenshot.authenticated === true,
|
|
1262
|
+
recordedAt: eventDate(screenshot)
|
|
1263
|
+
});
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
catch (e_24_1) { e_24 = { error: e_24_1 }; }
|
|
1268
|
+
finally {
|
|
1269
|
+
try {
|
|
1270
|
+
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
1271
|
+
}
|
|
1272
|
+
finally { if (e_24) throw e_24.error; }
|
|
1273
|
+
}
|
|
1274
|
+
return probes;
|
|
1275
|
+
}
|
|
1276
|
+
function collectBusinessAssertions(evidence) {
|
|
1277
|
+
var e_25, _a;
|
|
1278
|
+
var assertions = [];
|
|
1279
|
+
var rows = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.businessAssertions)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.business_assertions)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.workflowAssertions)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.workflow_assertions)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.assertions)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.qaRows)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.qa_rows)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.rows)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.supportQaAssertions)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.support_qa_assertions)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.aiQaBusinessAssertions)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.ai_qa_business_assertions)), false);
|
|
1280
|
+
try {
|
|
1281
|
+
for (var rows_2 = __values(rows), rows_2_1 = rows_2.next(); !rows_2_1.done; rows_2_1 = rows_2.next()) {
|
|
1282
|
+
var entry = rows_2_1.value;
|
|
1283
|
+
assertions.push({
|
|
1284
|
+
assertion: cleanText(entry.assertion || entry.name || entry.label || entry.workflow || entry.expected, 1000) || 'business assertion',
|
|
1285
|
+
status: entry.status || entry.outcome || entry.result || statusFromBoolean(entry.passed),
|
|
1286
|
+
workflow: cleanText(entry.workflow || entry.workflowName || entry.workflow_name, 400),
|
|
1287
|
+
route: cleanText(entry.route || entry.url, 500),
|
|
1288
|
+
action: cleanText(entry.action || entry.action_under_test || entry.actionUnderTest, 500),
|
|
1289
|
+
expected: cleanText(entry.expected || entry.expected_business_state_change || entry.expectedBusinessStateChange, 1000),
|
|
1290
|
+
observed: cleanText(entry.observed || entry.actual || entry.after || entry.after_state || entry.afterState, 1000),
|
|
1291
|
+
dataProof: cleanText(entry.dataProof || entry.data_proof || entry.domProof || entry.dom_proof || entry.proof || entry.summary, 1400),
|
|
1292
|
+
mongoDelta: plainObject(entry.mongoDelta || entry.mongo_delta),
|
|
1293
|
+
artifactPaths: cleanStringList(entry.artifactPaths || entry.artifact_paths || entry.artifacts || entry.screenshots || (entry.screenshot ? [entry.screenshot] : []), 30, 500),
|
|
1294
|
+
message: cleanText(entry.message || entry.error || entry.reason, 1000),
|
|
1295
|
+
recordedAt: eventDate(entry),
|
|
1296
|
+
metadata: __assign(__assign(__assign({}, plainObject(entry.metadata)), (entry.acceptanceBlocked === true || entry.acceptance_blocked === true ? { acceptanceBlocked: true } : {})), (entry.routeOnly === true || entry.route_only === true ? { routeOnly: true } : {}))
|
|
1297
|
+
});
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
catch (e_25_1) { e_25 = { error: e_25_1 }; }
|
|
1301
|
+
finally {
|
|
1302
|
+
try {
|
|
1303
|
+
if (rows_2_1 && !rows_2_1.done && (_a = rows_2.return)) _a.call(rows_2);
|
|
1304
|
+
}
|
|
1305
|
+
finally { if (e_25) throw e_25.error; }
|
|
1306
|
+
}
|
|
1307
|
+
if (!assertions.length && (evidence === null || evidence === void 0 ? void 0 : evidence.qaRunOutcome) === 'business_assertion_passed') {
|
|
1308
|
+
assertions.push({
|
|
1309
|
+
assertion: cleanText(evidence.aiRunOutcomeReason || evidence.reason || 'Historical business assertion passed.', 1000),
|
|
1310
|
+
status: 'pass',
|
|
1311
|
+
dataProof: cleanText(evidence.aiRunOutcomeReason || evidence.reason, 1400)
|
|
1312
|
+
});
|
|
1313
|
+
}
|
|
1314
|
+
if (!assertions.length && (evidence === null || evidence === void 0 ? void 0 : evidence.qaRunOutcome) === 'business_assertion_failed') {
|
|
1315
|
+
assertions.push({
|
|
1316
|
+
assertion: cleanText(evidence.aiRunOutcomeReason || evidence.reason || 'Historical business assertion failed.', 1000),
|
|
1317
|
+
status: 'fail',
|
|
1318
|
+
observed: cleanText(evidence.aiRunOutcomeReason || evidence.reason, 1000)
|
|
1319
|
+
});
|
|
1320
|
+
}
|
|
1321
|
+
return assertions;
|
|
1322
|
+
}
|
|
1323
|
+
function buildQaFromEvidence(evidence, now) {
|
|
1324
|
+
return (0, ai_run_evidence_1.buildAIQaRun)({
|
|
1325
|
+
infraChecks: collectInfraChecks(evidence),
|
|
1326
|
+
compile: collectCompileResult(evidence),
|
|
1327
|
+
routeProbes: collectRouteProbes(evidence),
|
|
1328
|
+
businessAssertions: collectBusinessAssertions(evidence),
|
|
1329
|
+
artifacts: collectArtifacts(evidence),
|
|
1330
|
+
now: now
|
|
1331
|
+
});
|
|
1332
|
+
}
|
|
1333
|
+
function isoNow(value) {
|
|
1334
|
+
if (value instanceof Date) {
|
|
1335
|
+
return value.toISOString();
|
|
1336
|
+
}
|
|
1337
|
+
if (value) {
|
|
1338
|
+
var parsed = new Date(value);
|
|
1339
|
+
if (!Number.isNaN(parsed.getTime())) {
|
|
1340
|
+
return parsed.toISOString();
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
return new Date().toISOString();
|
|
1344
|
+
}
|
|
1345
|
+
function normalizeMatchText(value) {
|
|
1346
|
+
return cleanText(value, 3000)
|
|
1347
|
+
.toLowerCase()
|
|
1348
|
+
.replace(/[^a-z0-9]+/g, ' ')
|
|
1349
|
+
.replace(/\s+/g, ' ')
|
|
1350
|
+
.trim();
|
|
1351
|
+
}
|
|
1352
|
+
function importantTokens(value) {
|
|
1353
|
+
var stopWords = new Set([
|
|
1354
|
+
'the', 'and', 'that', 'with', 'from', 'after', 'before', 'when', 'then', 'this', 'must',
|
|
1355
|
+
'should', 'will', 'only', 'into', 'have', 'has', 'are', 'was', 'were', 'been'
|
|
1356
|
+
]);
|
|
1357
|
+
return new Set(normalizeMatchText(value).split(' ')
|
|
1358
|
+
.filter(function (token) { return token.length >= 4 && !stopWords.has(token); }));
|
|
1359
|
+
}
|
|
1360
|
+
function businessAssertionPassed(assertion) {
|
|
1361
|
+
return /^(pass|passed|success|ok|done)$/i.test(cleanText(assertion.status, 40));
|
|
1362
|
+
}
|
|
1363
|
+
function supportAssertionMatchesDiagnosisProof(assertion, proofPlan) {
|
|
1364
|
+
var e_26, _a;
|
|
1365
|
+
var metadata = assertion.metadata || {};
|
|
1366
|
+
if (metadata.diagnosisProofPlanMatched === true || metadata.proofPlanMatched === true || metadata.supportDiagnosisProof === true) {
|
|
1367
|
+
return true;
|
|
1368
|
+
}
|
|
1369
|
+
var requiredBusinessAssertion = proofPlan.business_assertion || proofPlan.businessAssertion;
|
|
1370
|
+
var proofParts = [
|
|
1371
|
+
requiredBusinessAssertion,
|
|
1372
|
+
proofPlan.after,
|
|
1373
|
+
proofPlan.data_assertion || proofPlan.dataAssertion,
|
|
1374
|
+
proofPlan.artifact_expectation || proofPlan.artifactExpectation
|
|
1375
|
+
].map(function (part) { return normalizeMatchText(part); }).filter(function (part) { return part.length >= 16; });
|
|
1376
|
+
if (!proofParts.length) {
|
|
1377
|
+
return true;
|
|
1378
|
+
}
|
|
1379
|
+
var assertionText = normalizeMatchText([
|
|
1380
|
+
assertion.assertion,
|
|
1381
|
+
assertion.workflow,
|
|
1382
|
+
assertion.action,
|
|
1383
|
+
assertion.expected,
|
|
1384
|
+
assertion.observed,
|
|
1385
|
+
assertion.dataProof,
|
|
1386
|
+
assertion.message
|
|
1387
|
+
].filter(Boolean).join(' '));
|
|
1388
|
+
if (proofParts.some(function (part) { return assertionText.includes(part); })) {
|
|
1389
|
+
return true;
|
|
1390
|
+
}
|
|
1391
|
+
var proofTokens = importantTokens([
|
|
1392
|
+
requiredBusinessAssertion,
|
|
1393
|
+
proofPlan.after,
|
|
1394
|
+
proofPlan.data_assertion || proofPlan.dataAssertion
|
|
1395
|
+
].filter(Boolean).join(' '));
|
|
1396
|
+
var assertionTokens = importantTokens(assertionText);
|
|
1397
|
+
if (!proofTokens.size) {
|
|
1398
|
+
return true;
|
|
1399
|
+
}
|
|
1400
|
+
var overlap = 0;
|
|
1401
|
+
try {
|
|
1402
|
+
for (var proofTokens_1 = __values(proofTokens), proofTokens_1_1 = proofTokens_1.next(); !proofTokens_1_1.done; proofTokens_1_1 = proofTokens_1.next()) {
|
|
1403
|
+
var token = proofTokens_1_1.value;
|
|
1404
|
+
if (assertionTokens.has(token)) {
|
|
1405
|
+
overlap += 1;
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
catch (e_26_1) { e_26 = { error: e_26_1 }; }
|
|
1410
|
+
finally {
|
|
1411
|
+
try {
|
|
1412
|
+
if (proofTokens_1_1 && !proofTokens_1_1.done && (_a = proofTokens_1.return)) _a.call(proofTokens_1);
|
|
1413
|
+
}
|
|
1414
|
+
finally { if (e_26) throw e_26.error; }
|
|
1415
|
+
}
|
|
1416
|
+
return overlap >= Math.min(4, Math.max(3, Math.ceil(proofTokens.size * 0.45)));
|
|
1417
|
+
}
|
|
1418
|
+
function supportDiagnosisProofGateResult(diagnosisGate, now) {
|
|
1419
|
+
var proofPlan = diagnosisGate.proof_plan || diagnosisGate.proofPlan || {};
|
|
1420
|
+
return {
|
|
1421
|
+
key: 'support_diagnosis_business_proof',
|
|
1422
|
+
label: 'Diagnosis proof plan',
|
|
1423
|
+
status: 'blocked',
|
|
1424
|
+
reason: 'Support business assertion did not map to the diagnosis proof_plan. Route proof or generic workflow proof cannot accept the ticket.',
|
|
1425
|
+
evidenceRefs: [],
|
|
1426
|
+
recordedAt: isoNow(now),
|
|
1427
|
+
metadata: {
|
|
1428
|
+
issueClass: cleanText(diagnosisGate.issue_class || diagnosisGate.issueClass, 120),
|
|
1429
|
+
requiredBusinessAssertion: cleanText(proofPlan.business_assertion || proofPlan.businessAssertion, 1000),
|
|
1430
|
+
requiredAfter: cleanText(proofPlan.after, 1000),
|
|
1431
|
+
requiredDataAssertion: cleanText(proofPlan.data_assertion || proofPlan.dataAssertion, 1000)
|
|
1432
|
+
}
|
|
1433
|
+
};
|
|
1434
|
+
}
|
|
1435
|
+
var SUPPORT_ROOT_CAUSE_ENTRY_REQUIRED_FIELDS = [
|
|
1436
|
+
'issue_case',
|
|
1437
|
+
'issue_class',
|
|
1438
|
+
'accepted_hypothesis',
|
|
1439
|
+
'rejected_alternatives',
|
|
1440
|
+
'failing_path',
|
|
1441
|
+
'owner_files',
|
|
1442
|
+
'proof_plan',
|
|
1443
|
+
'evidence'
|
|
1444
|
+
];
|
|
1445
|
+
var SUPPORT_ROOT_CAUSE_ENTRY_ISSUE_CLASSES = [
|
|
1446
|
+
'no_op_submit',
|
|
1447
|
+
'missing_wrong_data',
|
|
1448
|
+
'filter_query_mismatch',
|
|
1449
|
+
'invoice_pdf_export',
|
|
1450
|
+
'upload_import',
|
|
1451
|
+
'route_auth_hydration',
|
|
1452
|
+
'slow_query_performance'
|
|
1453
|
+
];
|
|
1454
|
+
function supportRootCauseEntryContractGate(contract, now) {
|
|
1455
|
+
if (!contract || !Object.keys(contract).length) {
|
|
1456
|
+
return undefined;
|
|
1457
|
+
}
|
|
1458
|
+
var requiredOutput = plainObject(contract.required_output || contract.requiredOutput);
|
|
1459
|
+
var ownerPolicy = plainObject(contract.owner_file_policy || contract.ownerFilePolicy);
|
|
1460
|
+
var businessProofPolicy = plainObject(contract.business_proof_policy || contract.businessProofPolicy);
|
|
1461
|
+
var failurePolicy = plainObject(contract.failure_policy || contract.failurePolicy);
|
|
1462
|
+
var probes = asArray(contract.issue_class_probes || contract.issueClassProbes);
|
|
1463
|
+
var requiredFields = cleanStringList(requiredOutput.required_fields || requiredOutput.requiredFields, 30, 160);
|
|
1464
|
+
var issueClasses = probes.map(function (probe) { return cleanText(probe.issue_class || probe.issueClass, 120); }).filter(Boolean);
|
|
1465
|
+
var missingRequiredFields = SUPPORT_ROOT_CAUSE_ENTRY_REQUIRED_FIELDS.filter(function (field) { return !requiredFields.includes(field); });
|
|
1466
|
+
var missingIssueClasses = SUPPORT_ROOT_CAUSE_ENTRY_ISSUE_CLASSES.filter(function (issueClass) { return !issueClasses.includes(issueClass); });
|
|
1467
|
+
var blockers = [];
|
|
1468
|
+
if (!cleanText(contract.contract_id || contract.contractId, 160)) {
|
|
1469
|
+
blockers.push('Root-cause entry contract is missing contract_id.');
|
|
1470
|
+
}
|
|
1471
|
+
if (cleanText(requiredOutput.object_key || requiredOutput.objectKey, 120) !== 'support_diagnosis_gate') {
|
|
1472
|
+
blockers.push('Root-cause entry contract must require support_diagnosis_gate output.');
|
|
1473
|
+
}
|
|
1474
|
+
if (missingRequiredFields.length) {
|
|
1475
|
+
blockers.push("Root-cause entry contract missing required output fields: ".concat(missingRequiredFields.join(', '), "."));
|
|
1476
|
+
}
|
|
1477
|
+
var ownerFileMax = Number(ownerPolicy.max_files || ownerPolicy.maxFiles || 0);
|
|
1478
|
+
if (!Number.isFinite(ownerFileMax) || ownerFileMax <= 0 || ownerFileMax > 12) {
|
|
1479
|
+
blockers.push('Root-cause entry contract must cap owner_files to a small exact file set.');
|
|
1480
|
+
}
|
|
1481
|
+
if (ownerPolicy.edits_outside_owner_files_require_revised_diagnosis !== true && ownerPolicy.editsOutsideOwnerFilesRequireRevisedDiagnosis !== true) {
|
|
1482
|
+
blockers.push('Root-cause entry contract must require revised diagnosis before edits outside owner_files.');
|
|
1483
|
+
}
|
|
1484
|
+
if (businessProofPolicy.requires_aiqa_business_assertion !== true && businessProofPolicy.requiresAiqaBusinessAssertion !== true) {
|
|
1485
|
+
blockers.push('Root-cause entry contract must require AIQaBusinessAssertion business proof.');
|
|
1486
|
+
}
|
|
1487
|
+
if (businessProofPolicy.route_load_screenshot_scorecard_model_claim_not_acceptance !== true && businessProofPolicy.routeLoadScreenshotScorecardModelClaimNotAcceptance !== true) {
|
|
1488
|
+
blockers.push('Root-cause entry contract must reject route-load/screenshot/scorecard/model-claim acceptance.');
|
|
1489
|
+
}
|
|
1490
|
+
if (failurePolicy.repeated_failure_without_new_evidence_parks_run !== true && failurePolicy.repeatedFailureWithoutNewEvidenceParksRun !== true) {
|
|
1491
|
+
blockers.push('Root-cause entry contract must park repeated failures without new evidence.');
|
|
1492
|
+
}
|
|
1493
|
+
if (missingIssueClasses.length) {
|
|
1494
|
+
blockers.push("Root-cause entry contract missing issue-class probes: ".concat(missingIssueClasses.join(', '), "."));
|
|
1495
|
+
}
|
|
1496
|
+
var status = blockers.length ? 'fail' : 'pass';
|
|
1497
|
+
return {
|
|
1498
|
+
key: 'support_root_cause_entry_contract',
|
|
1499
|
+
label: 'Root-cause entry contract',
|
|
1500
|
+
status: status,
|
|
1501
|
+
reason: blockers.length
|
|
1502
|
+
? blockers.join(' ')
|
|
1503
|
+
: 'Support run has a structured root-cause-first entry contract with issue-class probes, owner-file policy, and business-proof policy.',
|
|
1504
|
+
evidenceRefs: cleanStringList(businessProofPolicy.required_artifacts || businessProofPolicy.requiredArtifacts, 20, 500),
|
|
1505
|
+
recordedAt: isoNow(now),
|
|
1506
|
+
metadata: {
|
|
1507
|
+
contractId: cleanText(contract.contract_id || contract.contractId, 160),
|
|
1508
|
+
version: cleanText(contract.version, 120),
|
|
1509
|
+
status: cleanText(contract.status, 120),
|
|
1510
|
+
requiredOutputKey: cleanText(requiredOutput.object_key || requiredOutput.objectKey, 120),
|
|
1511
|
+
requiredFields: requiredFields,
|
|
1512
|
+
missingRequiredFields: missingRequiredFields,
|
|
1513
|
+
ownerFileMax: ownerFileMax,
|
|
1514
|
+
requiresRevisedDiagnosisForOutOfScopeEdits: ownerPolicy.edits_outside_owner_files_require_revised_diagnosis === true || ownerPolicy.editsOutsideOwnerFilesRequireRevisedDiagnosis === true,
|
|
1515
|
+
requiresBusinessAssertion: businessProofPolicy.requires_aiqa_business_assertion === true || businessProofPolicy.requiresAiqaBusinessAssertion === true,
|
|
1516
|
+
routeOnlyAcceptanceRejected: businessProofPolicy.route_load_screenshot_scorecard_model_claim_not_acceptance === true || businessProofPolicy.routeLoadScreenshotScorecardModelClaimNotAcceptance === true,
|
|
1517
|
+
issueClassProbeCount: issueClasses.length,
|
|
1518
|
+
issueClasses: issueClasses,
|
|
1519
|
+
missingIssueClasses: missingIssueClasses
|
|
1520
|
+
}
|
|
1521
|
+
};
|
|
1522
|
+
}
|
|
1523
|
+
function applySupportDiagnosisProofGate(qa, diagnosisGate, now) {
|
|
1524
|
+
var proofPlan = diagnosisGate.proof_plan || diagnosisGate.proofPlan || {};
|
|
1525
|
+
var requiredBusinessAssertion = cleanText(proofPlan.business_assertion || proofPlan.businessAssertion, 1000);
|
|
1526
|
+
var requiredAfter = cleanText(proofPlan.after, 1000);
|
|
1527
|
+
if (!Object.keys(proofPlan).length || (!requiredBusinessAssertion && !requiredAfter)) {
|
|
1528
|
+
return qa;
|
|
1529
|
+
}
|
|
1530
|
+
var passedAssertions = qa.businessAssertions.filter(businessAssertionPassed);
|
|
1531
|
+
if (!passedAssertions.length) {
|
|
1532
|
+
return qa;
|
|
1533
|
+
}
|
|
1534
|
+
if (passedAssertions.some(function (assertion) { return supportAssertionMatchesDiagnosisProof(assertion, proofPlan); })) {
|
|
1535
|
+
return qa;
|
|
1536
|
+
}
|
|
1537
|
+
var gate = supportDiagnosisProofGateResult(diagnosisGate, now);
|
|
1538
|
+
return __assign(__assign({}, qa), { outcome: qa.routeProbes.some(function (probe) { return /^(pass|passed|success|ok|done)$/i.test(cleanText(probe.status, 40)); })
|
|
1539
|
+
? 'route_only_pass'
|
|
1540
|
+
: 'incomplete', gateResults: __spreadArray(__spreadArray([], __read(qa.gateResults.filter(function (existing) { return !(existing.key === 'qa_business_assertion' && existing.status === 'pass'); })), false), [
|
|
1541
|
+
gate
|
|
1542
|
+
], false) });
|
|
1543
|
+
}
|
|
1544
|
+
var SUPPORT_PRODUCT_REPAIR_STEP_TYPES = new Set([
|
|
1545
|
+
'build_repair',
|
|
1546
|
+
'owner_scoped_repair',
|
|
1547
|
+
'product_repair',
|
|
1548
|
+
'code_repair'
|
|
1549
|
+
]);
|
|
1550
|
+
var SUPPORT_PRODUCT_REPAIR_ACTIONS = new Set([
|
|
1551
|
+
'run_owner_scoped_repair',
|
|
1552
|
+
'run_targeted_product_repair',
|
|
1553
|
+
'allow_product_repair'
|
|
1554
|
+
]);
|
|
1555
|
+
function supportSourceEditFiles(value) {
|
|
1556
|
+
return cleanStringList(value, 80, 500)
|
|
1557
|
+
.filter(function (filePath) {
|
|
1558
|
+
var normalized = filePath.replace(/\\/g, '/').toLowerCase();
|
|
1559
|
+
if (!normalized || /(^|\/)(qa-artifacts|runner-evidence|logs?|tmp|dist|node_modules)(\/|$)/.test(normalized)) {
|
|
1560
|
+
return false;
|
|
1561
|
+
}
|
|
1562
|
+
return /\.(?:ts|tsx|js|jsx|html|scss|css|json|mjs|cjs|vue|svelte|md)$/i.test(normalized);
|
|
1563
|
+
});
|
|
1564
|
+
}
|
|
1565
|
+
function supportRepairActivityFromRecord(value, source, index) {
|
|
1566
|
+
var record = plainObject(value);
|
|
1567
|
+
if (!Object.keys(record).length) {
|
|
1568
|
+
return undefined;
|
|
1569
|
+
}
|
|
1570
|
+
var stepType = cleanText(record.stepType || record.step_type || record.type, 120);
|
|
1571
|
+
var action = cleanText(record.action || record.primaryAction || record.primary_action || record.allowedDispatchAction || record.allowed_dispatch_action, 120);
|
|
1572
|
+
var lane = cleanText(record.lane || record.phase || record.category, 120).toLowerCase();
|
|
1573
|
+
var changedFiles = supportSourceEditFiles(record.changedFiles
|
|
1574
|
+
|| record.changed_files
|
|
1575
|
+
|| record.modifiedFiles
|
|
1576
|
+
|| record.modified_files
|
|
1577
|
+
|| record.editedFiles
|
|
1578
|
+
|| record.edited_files
|
|
1579
|
+
|| record.files);
|
|
1580
|
+
var explicitProductRepair = SUPPORT_PRODUCT_REPAIR_STEP_TYPES.has(stepType)
|
|
1581
|
+
|| SUPPORT_PRODUCT_REPAIR_ACTIONS.has(action)
|
|
1582
|
+
|| (lane === 'build' && changedFiles.length > 0);
|
|
1583
|
+
if (!explicitProductRepair) {
|
|
1584
|
+
return undefined;
|
|
1585
|
+
}
|
|
1586
|
+
var activityRef = cleanText(record.microtaskId
|
|
1587
|
+
|| record.microtask_id
|
|
1588
|
+
|| record.taskId
|
|
1589
|
+
|| record.task_id
|
|
1590
|
+
|| record.jobId
|
|
1591
|
+
|| record.job_id
|
|
1592
|
+
|| record._id
|
|
1593
|
+
|| record.id
|
|
1594
|
+
|| "".concat(source, ":").concat(index), 240);
|
|
1595
|
+
return { changedFiles: changedFiles, activityRef: activityRef };
|
|
1596
|
+
}
|
|
1597
|
+
function supportProductRepairEvidence(input, evidence) {
|
|
1598
|
+
var job = input.job || {};
|
|
1599
|
+
var records = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(asArray(job.supportV5StepHistory)), false), __read(asArray(job.support_v5_step_history)), false), __read(asArray(job.stepHistory)), false), __read(asArray(job.step_history)), false), __read(asArray(evidence.supportV5StepHistory)), false), __read(asArray(evidence.support_v5_step_history)), false), __read(asArray(evidence.stepHistory)), false), __read(asArray(evidence.step_history)), false), __read(asArray(input.taskEvents)), false), __read(asArray(input.aiJobs)), false), __read(asArray(input.buildPlans)), false);
|
|
1600
|
+
var activityRefs = [];
|
|
1601
|
+
var changedFiles = [];
|
|
1602
|
+
var activityCount = 0;
|
|
1603
|
+
records.forEach(function (record, index) {
|
|
1604
|
+
var activity = supportRepairActivityFromRecord(record, 'support_repair_activity', index);
|
|
1605
|
+
if (!activity) {
|
|
1606
|
+
return;
|
|
1607
|
+
}
|
|
1608
|
+
activityCount += 1;
|
|
1609
|
+
if (activity.activityRef) {
|
|
1610
|
+
activityRefs.push(activity.activityRef);
|
|
1611
|
+
}
|
|
1612
|
+
changedFiles.push.apply(changedFiles, __spreadArray([], __read(activity.changedFiles), false));
|
|
1613
|
+
});
|
|
1614
|
+
var directChangedFiles = supportSourceEditFiles(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(asArray(job.changedFiles)), false), __read(asArray(job.changed_files)), false), __read(asArray(job.modifiedFiles)), false), __read(asArray(job.modified_files)), false), __read(asArray(job.editedFiles)), false), __read(asArray(job.edited_files)), false), __read(asArray(evidence.changedFiles)), false), __read(asArray(evidence.changed_files)), false), __read(asArray(evidence.modifiedFiles)), false), __read(asArray(evidence.modified_files)), false), __read(asArray(evidence.editedFiles)), false), __read(asArray(evidence.edited_files)), false), __read(asArray(input.commits).flatMap(function (commit) { return asArray(commit.changedFiles || commit.changed_files || commit.files); })), false));
|
|
1615
|
+
if (directChangedFiles.length) {
|
|
1616
|
+
activityCount += 1;
|
|
1617
|
+
activityRefs.push('changed_files');
|
|
1618
|
+
changedFiles.push.apply(changedFiles, __spreadArray([], __read(directChangedFiles), false));
|
|
1619
|
+
}
|
|
1620
|
+
var uniqueChangedFiles = Array.from(new Set(changedFiles.map(function (filePath) { return cleanText(filePath, 500); }).filter(Boolean))).slice(0, 80);
|
|
1621
|
+
return {
|
|
1622
|
+
attempted: activityCount > 0,
|
|
1623
|
+
changedFiles: uniqueChangedFiles,
|
|
1624
|
+
activityRefs: Array.from(new Set(activityRefs.map(function (ref) { return cleanText(ref, 240); }).filter(Boolean))).slice(0, 40),
|
|
1625
|
+
activityCount: activityCount
|
|
1626
|
+
};
|
|
1627
|
+
}
|
|
1628
|
+
function supportDiagnosisBeforeRepairGate(diagnosisGate, repairEvidence, now) {
|
|
1629
|
+
var _a, _b;
|
|
1630
|
+
if (!repairEvidence.attempted) {
|
|
1631
|
+
return undefined;
|
|
1632
|
+
}
|
|
1633
|
+
var validation = (0, support_runner_v5_1.validateResolveIOSupportDiagnosisGate)(diagnosisGate);
|
|
1634
|
+
var status = validation.valid ? 'pass' : 'blocked';
|
|
1635
|
+
return {
|
|
1636
|
+
key: 'support_diagnosis_before_repair',
|
|
1637
|
+
label: 'Support diagnosis before repair',
|
|
1638
|
+
status: status,
|
|
1639
|
+
reason: validation.valid
|
|
1640
|
+
? 'Support product repair has a valid root-cause diagnosis gate and owner-file scope.'
|
|
1641
|
+
: 'Support product repair is blocked until a valid SupportDiagnosisGate records reproduction/classification, accepted hypothesis, rejected alternatives, owner_files, and before/action/after proof.',
|
|
1642
|
+
evidenceRefs: repairEvidence.changedFiles,
|
|
1643
|
+
recordedAt: isoNow(now),
|
|
1644
|
+
metadata: {
|
|
1645
|
+
repairAttempted: true,
|
|
1646
|
+
activityCount: repairEvidence.activityCount,
|
|
1647
|
+
activityRefs: repairEvidence.activityRefs,
|
|
1648
|
+
changedFiles: repairEvidence.changedFiles,
|
|
1649
|
+
diagnosisValid: validation.valid,
|
|
1650
|
+
diagnosisStatus: validation.status,
|
|
1651
|
+
blockers: validation.blockers,
|
|
1652
|
+
ownerFiles: ((_a = validation.normalized) === null || _a === void 0 ? void 0 : _a.owner_files) || [],
|
|
1653
|
+
issueClass: (_b = validation.normalized) === null || _b === void 0 ? void 0 : _b.issue_class,
|
|
1654
|
+
productRepairAllowed: validation.valid,
|
|
1655
|
+
allowedDispatchAction: validation.valid ? 'run_owner_scoped_repair' : 'run_read_only_diagnosis',
|
|
1656
|
+
requiredEvidence: validation.valid
|
|
1657
|
+
? ['AIQaBusinessAssertion mapped to diagnosis proof_plan before acceptance']
|
|
1658
|
+
: ['support_diagnosis_gate JSON', 'reproduction or blocked-reproduction reason', 'accepted_hypothesis with evidence', 'owner_files', 'proof_plan before/action/after']
|
|
1659
|
+
}
|
|
1660
|
+
};
|
|
1661
|
+
}
|
|
1662
|
+
function supportOwnerFileScopeGate(diagnosisGate, repairEvidence, now) {
|
|
1663
|
+
if (!repairEvidence.attempted) {
|
|
1664
|
+
return undefined;
|
|
1665
|
+
}
|
|
1666
|
+
var validation = (0, support_runner_v5_1.validateResolveIOSupportDiagnosisGate)(diagnosisGate);
|
|
1667
|
+
if (!validation.valid || !validation.normalized) {
|
|
1668
|
+
return undefined;
|
|
1669
|
+
}
|
|
1670
|
+
var outsideOwnerFiles = (0, support_runner_v5_1.changedFilesOutsideResolveIOSupportDiagnosisOwnerFiles)(validation.normalized, repairEvidence.changedFiles, { allowTests: true });
|
|
1671
|
+
var status = outsideOwnerFiles.length ? 'blocked' : 'pass';
|
|
1672
|
+
return {
|
|
1673
|
+
key: 'support_owner_file_scope',
|
|
1674
|
+
label: 'Support owner-file scope',
|
|
1675
|
+
status: status,
|
|
1676
|
+
reason: outsideOwnerFiles.length
|
|
1677
|
+
? "Support repair changed files outside diagnosis owner_files; revise diagnosis with new evidence before broadening edits: ".concat(outsideOwnerFiles.join(', '))
|
|
1678
|
+
: 'Support repair stayed within diagnosis owner_files; test-only changes are allowed as supporting evidence.',
|
|
1679
|
+
evidenceRefs: outsideOwnerFiles.length ? outsideOwnerFiles : repairEvidence.changedFiles,
|
|
1680
|
+
recordedAt: isoNow(now),
|
|
1681
|
+
metadata: {
|
|
1682
|
+
repairAttempted: true,
|
|
1683
|
+
diagnosisValid: true,
|
|
1684
|
+
issueClass: validation.normalized.issue_class,
|
|
1685
|
+
ownerFiles: validation.normalized.owner_files,
|
|
1686
|
+
changedFiles: repairEvidence.changedFiles,
|
|
1687
|
+
outsideOwnerFiles: outsideOwnerFiles,
|
|
1688
|
+
allowedTestFilesOutsideOwnerScope: true,
|
|
1689
|
+
productRepairAllowed: outsideOwnerFiles.length === 0,
|
|
1690
|
+
allowedDispatchAction: outsideOwnerFiles.length ? 'run_read_only_diagnosis' : 'run_business_proof_qa',
|
|
1691
|
+
requiredEvidence: outsideOwnerFiles.length
|
|
1692
|
+
? ['revised SupportDiagnosisGate with evidence for each new owner file', 'updated failing_path and proof_plan matching broadened scope']
|
|
1693
|
+
: ['compile/unit proof', 'AIQaBusinessAssertion mapped to diagnosis proof_plan']
|
|
1694
|
+
}
|
|
1695
|
+
};
|
|
1696
|
+
}
|
|
1697
|
+
function evidenceObject() {
|
|
1698
|
+
var e_27, _a;
|
|
1699
|
+
var values = [];
|
|
1700
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1701
|
+
values[_i] = arguments[_i];
|
|
1702
|
+
}
|
|
1703
|
+
try {
|
|
1704
|
+
for (var values_1 = __values(values), values_1_1 = values_1.next(); !values_1_1.done; values_1_1 = values_1.next()) {
|
|
1705
|
+
var value = values_1_1.value;
|
|
1706
|
+
if (value && typeof value === 'object' && !Array.isArray(value)) {
|
|
1707
|
+
return value;
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1710
|
+
}
|
|
1711
|
+
catch (e_27_1) { e_27 = { error: e_27_1 }; }
|
|
1712
|
+
finally {
|
|
1713
|
+
try {
|
|
1714
|
+
if (values_1_1 && !values_1_1.done && (_a = values_1.return)) _a.call(values_1);
|
|
1715
|
+
}
|
|
1716
|
+
finally { if (e_27) throw e_27.error; }
|
|
1717
|
+
}
|
|
1718
|
+
return {};
|
|
1719
|
+
}
|
|
1720
|
+
function mergeEvidenceRecords() {
|
|
1721
|
+
var e_28, _a, e_29, _b;
|
|
1722
|
+
var values = [];
|
|
1723
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1724
|
+
values[_i] = arguments[_i];
|
|
1725
|
+
}
|
|
1726
|
+
var merged = {};
|
|
1727
|
+
try {
|
|
1728
|
+
for (var values_2 = __values(values), values_2_1 = values_2.next(); !values_2_1.done; values_2_1 = values_2.next()) {
|
|
1729
|
+
var value = values_2_1.value;
|
|
1730
|
+
var source = plainObject(value);
|
|
1731
|
+
try {
|
|
1732
|
+
for (var _c = (e_29 = void 0, __values(Object.entries(source))), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
1733
|
+
var _e = __read(_d.value, 2), key = _e[0], entry = _e[1];
|
|
1734
|
+
if (entry === undefined || entry === null || entry === '') {
|
|
1735
|
+
continue;
|
|
1736
|
+
}
|
|
1737
|
+
if (Array.isArray(entry)) {
|
|
1738
|
+
merged[key] = __spreadArray(__spreadArray([], __read(asArray(merged[key])), false), __read(entry), false);
|
|
1739
|
+
continue;
|
|
1740
|
+
}
|
|
1741
|
+
if (plainObject(entry) === entry && plainObject(merged[key]) === merged[key]) {
|
|
1742
|
+
merged[key] = __assign(__assign({}, merged[key]), entry);
|
|
1743
|
+
continue;
|
|
1744
|
+
}
|
|
1745
|
+
merged[key] = entry;
|
|
1746
|
+
}
|
|
1747
|
+
}
|
|
1748
|
+
catch (e_29_1) { e_29 = { error: e_29_1 }; }
|
|
1749
|
+
finally {
|
|
1750
|
+
try {
|
|
1751
|
+
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
1752
|
+
}
|
|
1753
|
+
finally { if (e_29) throw e_29.error; }
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1757
|
+
catch (e_28_1) { e_28 = { error: e_28_1 }; }
|
|
1758
|
+
finally {
|
|
1759
|
+
try {
|
|
1760
|
+
if (values_2_1 && !values_2_1.done && (_a = values_2.return)) _a.call(values_2);
|
|
1761
|
+
}
|
|
1762
|
+
finally { if (e_28) throw e_28.error; }
|
|
1763
|
+
}
|
|
1764
|
+
return merged;
|
|
1765
|
+
}
|
|
1766
|
+
function buildSupportQaEvidence(input) {
|
|
1767
|
+
var job = input.job || {};
|
|
1768
|
+
var ticket = input.ticket || {};
|
|
1769
|
+
var qaCursor = plainObject(job.supportQaValidationCursor || job.support_qa_validation_cursor);
|
|
1770
|
+
var autonomousDecision = plainObject(job.supportV5AutonomousDecision || job.support_v5_autonomous_decision);
|
|
1771
|
+
var ticketAutomation = plainObject(ticket.automation);
|
|
1772
|
+
var ticketManager = plainObject(ticketAutomation.manager || ticket.manager);
|
|
1773
|
+
var preflightGate = supportPreflightGateObject(ticket, job, __assign(__assign({}, plainObject(input.qaEvidence)), { supportV5AutonomousDecision: autonomousDecision }));
|
|
1774
|
+
var businessProofReadiness = plainObject(autonomousDecision.businessProofReadiness
|
|
1775
|
+
|| autonomousDecision.business_proof_readiness
|
|
1776
|
+
|| job.businessProofReadiness
|
|
1777
|
+
|| job.business_proof_readiness);
|
|
1778
|
+
var customerReplyPolicy = plainObject(autonomousDecision.customerReplyPolicy
|
|
1779
|
+
|| autonomousDecision.customer_reply_policy
|
|
1780
|
+
|| job.customerReplyPolicy
|
|
1781
|
+
|| job.customer_reply_policy);
|
|
1782
|
+
var customerReplyReadiness = plainObject(autonomousDecision.customerReplyReadiness
|
|
1783
|
+
|| autonomousDecision.customer_reply_readiness
|
|
1784
|
+
|| customerReplyPolicy.readinessContract
|
|
1785
|
+
|| customerReplyPolicy.readiness_contract
|
|
1786
|
+
|| job.customerReplyReadiness
|
|
1787
|
+
|| job.customer_reply_readiness);
|
|
1788
|
+
var managerRecoveryExecutionProof = plainObject(job.managerRecoveryExecutionProof
|
|
1789
|
+
|| job.manager_recovery_execution_proof
|
|
1790
|
+
|| job.supportManagerRecoveryExecutionProof
|
|
1791
|
+
|| job.support_manager_recovery_execution_proof
|
|
1792
|
+
|| autonomousDecision.recoveryExecutionProof
|
|
1793
|
+
|| autonomousDecision.recovery_execution_proof
|
|
1794
|
+
|| ticketManager.last_recovery_execution_proof
|
|
1795
|
+
|| ticketManager.recovery_execution_proof);
|
|
1796
|
+
var humanReviewPacket = plainObject(autonomousDecision.humanReviewPacket
|
|
1797
|
+
|| autonomousDecision.human_review_packet
|
|
1798
|
+
|| customerReplyPolicy.humanReviewPacket
|
|
1799
|
+
|| customerReplyPolicy.human_review_packet
|
|
1800
|
+
|| job.humanReviewPacket
|
|
1801
|
+
|| job.human_review_packet);
|
|
1802
|
+
var evidence = mergeEvidenceRecords(qaCursor, job.qaEvidence, job.qa_evidence, ticket.qaEvidence, ticket.qa_evidence, input.qaEvidence);
|
|
1803
|
+
evidence.supportQaAssertions = __spreadArray(__spreadArray(__spreadArray([], __read(asArray(job.supportQaAssertions)), false), __read(asArray(job.support_qa_assertions)), false), __read(asArray(evidence.supportQaAssertions)), false);
|
|
1804
|
+
evidence.aiQaBusinessAssertions = __spreadArray(__spreadArray(__spreadArray([], __read(asArray(job.aiQaBusinessAssertions)), false), __read(asArray(job.ai_qa_business_assertions)), false), __read(asArray(evidence.aiQaBusinessAssertions)), false);
|
|
1805
|
+
evidence.runnerEvidenceArtifacts = __spreadArray(__spreadArray(__spreadArray([], __read(asArray(job.runnerEvidenceArtifacts)), false), __read(asArray(job.runner_evidence_artifacts)), false), __read(asArray(evidence.runnerEvidenceArtifacts)), false);
|
|
1806
|
+
evidence.supportQaArtifacts = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(asArray(job.supportQaArtifacts)), false), __read(asArray(job.support_qa_artifacts)), false), __read(asArray(job.qa_artifacts)), false), __read(asArray(evidence.supportQaArtifacts)), false);
|
|
1807
|
+
if (Object.keys(businessProofReadiness).length) {
|
|
1808
|
+
evidence.businessProofReadiness = businessProofReadiness;
|
|
1809
|
+
}
|
|
1810
|
+
if (Object.keys(customerReplyPolicy).length) {
|
|
1811
|
+
evidence.customerReplyPolicy = __assign(__assign({}, customerReplyPolicy), (Object.keys(humanReviewPacket).length ? { humanReviewPacket: humanReviewPacket } : {}));
|
|
1812
|
+
}
|
|
1813
|
+
else if (Object.keys(humanReviewPacket).length) {
|
|
1814
|
+
evidence.customerReplyPolicy = { humanReviewPacket: humanReviewPacket };
|
|
1815
|
+
}
|
|
1816
|
+
if (Object.keys(customerReplyReadiness).length) {
|
|
1817
|
+
evidence.customerReplyReadiness = customerReplyReadiness;
|
|
1818
|
+
}
|
|
1819
|
+
if (Object.keys(managerRecoveryExecutionProof).length) {
|
|
1820
|
+
evidence.managerRecoveryExecutionProof = managerRecoveryExecutionProof;
|
|
1821
|
+
}
|
|
1822
|
+
if (Object.keys(preflightGate).length) {
|
|
1823
|
+
evidence.supportV5PreflightGate = preflightGate;
|
|
1824
|
+
applySupportPreflightGateToQaEvidence(evidence, preflightGate);
|
|
1825
|
+
}
|
|
1826
|
+
return evidence;
|
|
1827
|
+
}
|
|
1828
|
+
function supportPreflightGateObject(ticket, job, evidence) {
|
|
1829
|
+
var _a, _b;
|
|
1830
|
+
var autonomousDecision = plainObject(job.supportV5AutonomousDecision
|
|
1831
|
+
|| job.support_v5_autonomous_decision
|
|
1832
|
+
|| evidence.supportV5AutonomousDecision
|
|
1833
|
+
|| evidence.support_v5_autonomous_decision
|
|
1834
|
+
|| ticket.supportV5AutonomousDecision
|
|
1835
|
+
|| ticket.support_v5_autonomous_decision);
|
|
1836
|
+
var ticketAutomation = plainObject(ticket.automation);
|
|
1837
|
+
var ticketManager = plainObject(ticketAutomation.manager || ticket.manager);
|
|
1838
|
+
return evidenceObject(job.supportV5PreflightGate, job.support_v5_preflight_gate, job.preflightGate, job.preflight_gate, evidence.supportV5PreflightGate, evidence.support_v5_preflight_gate, evidence.preflightGate, evidence.preflight_gate, autonomousDecision.preflightGate, autonomousDecision.preflight_gate, (_a = autonomousDecision.rootCauseReadiness) === null || _a === void 0 ? void 0 : _a.preflightGate, (_b = autonomousDecision.root_cause_readiness) === null || _b === void 0 ? void 0 : _b.preflight_gate, ticket.supportV5PreflightGate, ticket.support_v5_preflight_gate, ticketManager.supportV5PreflightGate, ticketManager.support_v5_preflight_gate, ticketManager.preflightGate, ticketManager.preflight_gate);
|
|
1839
|
+
}
|
|
1840
|
+
function supportPreflightStatus(value) {
|
|
1841
|
+
return cleanText(value, 120).toLowerCase();
|
|
1842
|
+
}
|
|
1843
|
+
function supportPreflightFailedChecks(preflightGate) {
|
|
1844
|
+
var failed = __spreadArray(__spreadArray([], __read(asArray(preflightGate.failedChecks || preflightGate.failed_checks)), false), __read(asArray(preflightGate.checks).filter(function (check) {
|
|
1845
|
+
var status = supportPreflightStatus(check.status || check.state || check.outcome);
|
|
1846
|
+
return /fail|failed|blocked|missing|error/.test(status);
|
|
1847
|
+
})), false);
|
|
1848
|
+
var seen = new Set();
|
|
1849
|
+
return failed.filter(function (check) {
|
|
1850
|
+
var key = "".concat(cleanText(check.name || check.check || check.key, 160), ":").concat(cleanText(check.summary || check.message || check.error || check.reason, 500));
|
|
1851
|
+
if (seen.has(key)) {
|
|
1852
|
+
return false;
|
|
1853
|
+
}
|
|
1854
|
+
seen.add(key);
|
|
1855
|
+
return true;
|
|
1856
|
+
});
|
|
1857
|
+
}
|
|
1858
|
+
function supportPreflightArtifactPaths(preflightGate, checks) {
|
|
1859
|
+
return Array.from(new Set(__spreadArray(__spreadArray(__spreadArray([], __read(cleanStringList(preflightGate.artifactPaths || preflightGate.artifact_paths, 60, 500)), false), __read(checks.flatMap(function (check) { return cleanStringList(check.artifactPaths || check.artifact_paths || check.artifacts, 20, 500); })), false), __read(checks.map(function (check) { return cleanText(check.artifactPath || check.artifact_path || check.path || check.file, 500); }).filter(Boolean)), false))).slice(0, 80);
|
|
1860
|
+
}
|
|
1861
|
+
function supportPreflightCheckMessage(check) {
|
|
1862
|
+
return cleanText(check.summary || check.message || check.error || check.reason || check.status, 1000);
|
|
1863
|
+
}
|
|
1864
|
+
function applySupportPreflightGateToQaEvidence(evidence, preflightGate) {
|
|
1865
|
+
var _a;
|
|
1866
|
+
var status = supportPreflightStatus(preflightGate.status);
|
|
1867
|
+
var failureClass = supportPreflightStatus(preflightGate.failureClass || preflightGate.failure_class);
|
|
1868
|
+
var failedChecks = supportPreflightFailedChecks(preflightGate);
|
|
1869
|
+
var artifactPaths = supportPreflightArtifactPaths(preflightGate, failedChecks);
|
|
1870
|
+
var compileResult = plainObject(preflightGate.compileResult || preflightGate.compile_result);
|
|
1871
|
+
var compileFailed = status === 'compile_failed'
|
|
1872
|
+
|| failureClass === 'compile'
|
|
1873
|
+
|| cleanText(compileResult.failureClass || compileResult.failure_class, 120).toLowerCase() === 'compile'
|
|
1874
|
+
|| failedChecks.some(function (check) {
|
|
1875
|
+
var name = supportPreflightStatus(check.name || check.check || check.key);
|
|
1876
|
+
var checkClass = supportPreflightStatus(check.failureClass || check.failure_class);
|
|
1877
|
+
return name === 'compile' || checkClass === 'compile';
|
|
1878
|
+
});
|
|
1879
|
+
if (compileFailed) {
|
|
1880
|
+
var compileCheck = Object.keys(compileResult).length ? compileResult : failedChecks[0] || {};
|
|
1881
|
+
evidence.compile = __assign(__assign({}, plainObject(evidence.compile || evidence.build || evidence.buildResult || evidence.build_result)), { status: cleanText(compileCheck.status || preflightGate.status || 'fail', 80) || 'fail', command: cleanText(compileCheck.command || preflightGate.command || preflightGate.nextCommand || preflightGate.next_command, 500), artifactPath: artifactPaths[0] || cleanText(compileCheck.artifactPath || compileCheck.artifact_path || compileCheck.path, 500), message: supportPreflightCheckMessage(compileCheck) || cleanText(preflightGate.reason || ((_a = preflightGate.blockers) === null || _a === void 0 ? void 0 : _a[0]) || 'Support compile preflight failed before browser QA.', 1000), metadata: {
|
|
1882
|
+
source: 'supportV5PreflightGate',
|
|
1883
|
+
preflightStatus: status,
|
|
1884
|
+
preflightEvidenceHash: cleanText(preflightGate.evidenceHash || preflightGate.evidence_hash, 200),
|
|
1885
|
+
nextCommand: cleanText(preflightGate.nextCommand || preflightGate.next_command, 180)
|
|
1886
|
+
} });
|
|
1887
|
+
return;
|
|
1888
|
+
}
|
|
1889
|
+
var blocksRepair = preflightGate.blocksProductRepair === true || preflightGate.blocks_product_repair === true || /infra_failed|blocked|missing/.test(status);
|
|
1890
|
+
var checks = failedChecks.length
|
|
1891
|
+
? failedChecks
|
|
1892
|
+
: Object.keys(preflightGate).length && (blocksRepair || status === 'passed')
|
|
1893
|
+
? [{
|
|
1894
|
+
name: 'support_preflight',
|
|
1895
|
+
status: status === 'passed' ? 'pass' : 'blocked',
|
|
1896
|
+
summary: cleanStringList(preflightGate.blockers, 4, 500).join('; ') || cleanText(preflightGate.reason || preflightGate.status, 1000),
|
|
1897
|
+
artifactPaths: artifactPaths
|
|
1898
|
+
}]
|
|
1899
|
+
: [];
|
|
1900
|
+
if (!checks.length) {
|
|
1901
|
+
return;
|
|
1902
|
+
}
|
|
1903
|
+
evidence.infraChecks = __spreadArray(__spreadArray([], __read(asArray(evidence.infraChecks)), false), __read(checks.map(function (check) { return ({
|
|
1904
|
+
name: cleanText(check.name || check.check || check.key, 160) || 'support_preflight',
|
|
1905
|
+
status: cleanText(check.status || check.state || check.outcome || (status === 'passed' ? 'pass' : 'blocked'), 80),
|
|
1906
|
+
message: supportPreflightCheckMessage(check) || cleanStringList(preflightGate.blockers, 3, 500).join('; '),
|
|
1907
|
+
path: cleanText(check.path || check.artifactPath || check.artifact_path, 500) || artifactPaths[0],
|
|
1908
|
+
metadata: {
|
|
1909
|
+
source: 'supportV5PreflightGate',
|
|
1910
|
+
preflightStatus: status,
|
|
1911
|
+
preflightFailureClass: failureClass,
|
|
1912
|
+
preflightEvidenceHash: cleanText(preflightGate.evidenceHash || preflightGate.evidence_hash, 200),
|
|
1913
|
+
nextCommand: cleanText(preflightGate.nextCommand || preflightGate.next_command, 180)
|
|
1914
|
+
}
|
|
1915
|
+
}); })), false);
|
|
1916
|
+
}
|
|
1917
|
+
function supportPreflightGateResult(preflightGate, now) {
|
|
1918
|
+
if (!preflightGate || !Object.keys(preflightGate).length) {
|
|
1919
|
+
return undefined;
|
|
1920
|
+
}
|
|
1921
|
+
var statusText = supportPreflightStatus(preflightGate.status);
|
|
1922
|
+
var ready = preflightGate.ready === true;
|
|
1923
|
+
var blocksProductRepair = preflightGate.blocksProductRepair === true || preflightGate.blocks_product_repair === true;
|
|
1924
|
+
var failedChecks = supportPreflightFailedChecks(preflightGate);
|
|
1925
|
+
var artifactPaths = supportPreflightArtifactPaths(preflightGate, failedChecks);
|
|
1926
|
+
var gateStatus = ready || statusText === 'passed'
|
|
1927
|
+
? 'pass'
|
|
1928
|
+
: /compile_failed|infra_failed|fail|failed/.test(statusText)
|
|
1929
|
+
? 'fail'
|
|
1930
|
+
: blocksProductRepair || /missing|blocked/.test(statusText)
|
|
1931
|
+
? 'blocked'
|
|
1932
|
+
: 'warn';
|
|
1933
|
+
var blockers = cleanStringList(preflightGate.blockers, 20, 500);
|
|
1934
|
+
return {
|
|
1935
|
+
key: 'support_preflight_gate',
|
|
1936
|
+
label: 'Support preflight gate',
|
|
1937
|
+
status: gateStatus,
|
|
1938
|
+
reason: gateStatus === 'pass'
|
|
1939
|
+
? 'Support deterministic preflight passed before product-code repair.'
|
|
1940
|
+
: cleanText(blockers.join('; ') || preflightGate.reason || "Support deterministic preflight is ".concat(statusText || 'not ready', " before product-code repair."), 1200),
|
|
1941
|
+
evidenceRefs: artifactPaths,
|
|
1942
|
+
recordedAt: isoNow(now || preflightGate.recordedAt || preflightGate.recorded_at),
|
|
1943
|
+
metadata: {
|
|
1944
|
+
ready: ready,
|
|
1945
|
+
required: preflightGate.required === true,
|
|
1946
|
+
status: statusText,
|
|
1947
|
+
failureClass: cleanText(preflightGate.failureClass || preflightGate.failure_class, 120),
|
|
1948
|
+
nextCommand: cleanText(preflightGate.nextCommand || preflightGate.next_command, 180),
|
|
1949
|
+
blocksProductRepair: blocksProductRepair,
|
|
1950
|
+
blocksModelRepair: preflightGate.blocksModelRepair === true || preflightGate.blocks_model_repair === true,
|
|
1951
|
+
failedChecks: failedChecks.map(function (check) { return cleanText(check.name || check.check || check.key, 160); }).filter(Boolean),
|
|
1952
|
+
requiredEvidence: cleanStringList(preflightGate.requiredEvidence || preflightGate.required_evidence, 20, 500),
|
|
1953
|
+
evidenceHash: cleanText(preflightGate.evidenceHash || preflightGate.evidence_hash, 200)
|
|
1954
|
+
}
|
|
1955
|
+
};
|
|
1956
|
+
}
|
|
1957
|
+
function supportBusinessProofReadinessGate(readiness, now) {
|
|
1958
|
+
if (!readiness || !Object.keys(readiness).length) {
|
|
1959
|
+
return undefined;
|
|
1960
|
+
}
|
|
1961
|
+
var ready = readiness.ready === true;
|
|
1962
|
+
var readinessStatus = cleanText(readiness.status, 120).toLowerCase();
|
|
1963
|
+
var blockers = cleanStringList(readiness.blockers, 20, 500);
|
|
1964
|
+
var artifactPaths = cleanStringList(readiness.artifactPaths || readiness.artifact_paths, 40, 500);
|
|
1965
|
+
var proofFingerprint = cleanText(readiness.proofFingerprint || readiness.proof_fingerprint, 160);
|
|
1966
|
+
var artifactFingerprint = cleanText(readiness.artifactFingerprint || readiness.artifact_fingerprint, 160);
|
|
1967
|
+
var proofFreshness = cleanText(readiness.proofFreshness || readiness.proof_freshness, 120);
|
|
1968
|
+
var status = ready
|
|
1969
|
+
? 'pass'
|
|
1970
|
+
: /fail|failed/.test(readinessStatus)
|
|
1971
|
+
? 'fail'
|
|
1972
|
+
: /missing|route_only|blocked|weak|stale|incomplete/.test(readinessStatus)
|
|
1973
|
+
? 'blocked'
|
|
1974
|
+
: 'warn';
|
|
1975
|
+
return {
|
|
1976
|
+
key: 'support_business_proof_readiness',
|
|
1977
|
+
label: 'Support business proof readiness',
|
|
1978
|
+
status: status,
|
|
1979
|
+
reason: cleanText(readiness.reason || blockers.join('; ') || readinessStatus || 'Support business proof readiness recorded.', 1200),
|
|
1980
|
+
evidenceRefs: artifactPaths,
|
|
1981
|
+
recordedAt: isoNow(now || readiness.recordedAt || readiness.recorded_at),
|
|
1982
|
+
metadata: {
|
|
1983
|
+
ready: ready,
|
|
1984
|
+
status: readinessStatus,
|
|
1985
|
+
blockers: blockers,
|
|
1986
|
+
requiredEvidence: cleanStringList(readiness.requiredEvidence || readiness.required_evidence, 20, 500),
|
|
1987
|
+
proofFingerprint: proofFingerprint,
|
|
1988
|
+
artifactFingerprint: artifactFingerprint,
|
|
1989
|
+
proofFreshness: proofFreshness
|
|
1990
|
+
}
|
|
1991
|
+
};
|
|
1992
|
+
}
|
|
1993
|
+
function supportCustomerReplyPolicyGate(policy, now) {
|
|
1994
|
+
if (!policy || !Object.keys(policy).length) {
|
|
1995
|
+
return undefined;
|
|
1996
|
+
}
|
|
1997
|
+
var action = cleanText(policy.action, 120);
|
|
1998
|
+
var safety = cleanText(policy.safety, 120);
|
|
1999
|
+
var reason = cleanText(policy.reason, 1200);
|
|
2000
|
+
var canDraft = policy.canDraftCustomerReply === true || policy.can_draft_customer_reply === true;
|
|
2001
|
+
var canSend = policy.canSendCustomerReply === true || policy.can_send_customer_reply === true;
|
|
2002
|
+
var reviewPacket = plainObject(policy.humanReviewPacket || policy.human_review_packet);
|
|
2003
|
+
var draftBasis = plainObject(policy.draftBasis || policy.draft_basis);
|
|
2004
|
+
var clarificationValidation = (0, support_runner_v5_1.validateResolveIOSupportClarificationContract)(policy.clarificationContract || policy.clarification_contract || {});
|
|
2005
|
+
var clarificationContract = clarificationValidation.normalized;
|
|
2006
|
+
var reviewType = cleanText(reviewPacket.reviewType || reviewPacket.review_type, 160);
|
|
2007
|
+
var evidenceRefs = cleanStringList(reviewPacket.evidenceRefs || reviewPacket.evidence_refs, 40, 500);
|
|
2008
|
+
var blockers = cleanStringList(policy.blockers || reviewPacket.blockers, 20, 500);
|
|
2009
|
+
var gateStatus = canSend
|
|
2010
|
+
? 'blocked'
|
|
2011
|
+
: action === 'draft_resolution_reply' && canDraft
|
|
2012
|
+
? 'warn'
|
|
2013
|
+
: action === 'ask_clarification' && canDraft
|
|
2014
|
+
? (clarificationValidation.valid ? 'warn' : 'blocked')
|
|
2015
|
+
: 'blocked';
|
|
2016
|
+
var mergedBlockers = Array.from(new Set(__spreadArray(__spreadArray([], __read(blockers), false), __read((action === 'ask_clarification' ? clarificationValidation.blockers : [])), false)));
|
|
2017
|
+
return {
|
|
2018
|
+
key: 'support_customer_reply_policy',
|
|
2019
|
+
label: 'Support customer reply policy',
|
|
2020
|
+
status: gateStatus,
|
|
2021
|
+
reason: reason || mergedBlockers.join('; ') || action || 'Support customer reply policy recorded.',
|
|
2022
|
+
evidenceRefs: evidenceRefs,
|
|
2023
|
+
recordedAt: isoNow(now || policy.recordedAt || policy.recorded_at || reviewPacket.createdAt || reviewPacket.created_at),
|
|
2024
|
+
metadata: {
|
|
2025
|
+
action: action,
|
|
2026
|
+
safety: safety,
|
|
2027
|
+
canDraftCustomerReply: canDraft,
|
|
2028
|
+
canSendCustomerReply: canSend,
|
|
2029
|
+
confidenceLevel: cleanText(policy.confidenceLevel || policy.confidence_level, 120),
|
|
2030
|
+
issueClass: cleanText(draftBasis.issueClass || draftBasis.issue_class, 120),
|
|
2031
|
+
issueClassProbePlanId: cleanText(draftBasis.issueClassProbePlanId || draftBasis.issue_class_probe_plan_id, 180),
|
|
2032
|
+
issueClassProbePlanStatus: cleanText(draftBasis.issueClassProbePlanStatus || draftBasis.issue_class_probe_plan_status, 120),
|
|
2033
|
+
reviewType: reviewType,
|
|
2034
|
+
primaryAction: cleanText(reviewPacket.primaryAction || reviewPacket.primary_action, 160),
|
|
2035
|
+
requiresHumanApproval: reviewPacket.requiresHumanApproval !== false && reviewPacket.requires_human_approval !== false,
|
|
2036
|
+
questionPresent: !!cleanText(policy.clarificationQuestion || policy.clarification_question || reviewPacket.question, 1000),
|
|
2037
|
+
clarificationContractStatus: cleanText(clarificationContract.status, 120),
|
|
2038
|
+
clarificationMissingField: cleanText(clarificationContract.missingField, 120),
|
|
2039
|
+
clarificationOneQuestionOnly: clarificationContract.oneQuestionOnly === true,
|
|
2040
|
+
clarificationParksTicket: clarificationContract.parksTicketUntilCustomerReply === true,
|
|
2041
|
+
blockers: mergedBlockers
|
|
2042
|
+
}
|
|
2043
|
+
};
|
|
2044
|
+
}
|
|
2045
|
+
function supportCustomerReplyReadinessGate(contract, now) {
|
|
2046
|
+
if (!contract || !Object.keys(contract).length) {
|
|
2047
|
+
return undefined;
|
|
2048
|
+
}
|
|
2049
|
+
var validation = (0, support_runner_v5_1.validateResolveIOSupportCustomerReplyReadinessContract)(contract);
|
|
2050
|
+
var normalized = validation.normalized;
|
|
2051
|
+
var status = cleanText(normalized.status, 120);
|
|
2052
|
+
var gateStatus = normalized.canSendCustomerReply
|
|
2053
|
+
? 'blocked'
|
|
2054
|
+
: validation.valid && (status === 'draft_ready' || status === 'clarification_required')
|
|
2055
|
+
? 'warn'
|
|
2056
|
+
: 'blocked';
|
|
2057
|
+
return {
|
|
2058
|
+
key: 'support_customer_reply_readiness',
|
|
2059
|
+
label: 'Support customer reply readiness',
|
|
2060
|
+
status: gateStatus,
|
|
2061
|
+
reason: normalized.reason || validation.blockers.join('; ') || status || 'Support customer reply readiness recorded.',
|
|
2062
|
+
evidenceRefs: normalized.evidenceRefs,
|
|
2063
|
+
recordedAt: isoNow(now || normalized.createdAt),
|
|
2064
|
+
metadata: {
|
|
2065
|
+
contractId: normalized.contractId,
|
|
2066
|
+
status: status,
|
|
2067
|
+
policyAction: normalized.policyAction,
|
|
2068
|
+
reviewType: normalized.reviewType,
|
|
2069
|
+
primaryCommand: normalized.primaryCommand,
|
|
2070
|
+
canDraftCustomerReply: normalized.canDraftCustomerReply,
|
|
2071
|
+
canSendCustomerReply: normalized.canSendCustomerReply,
|
|
2072
|
+
requiresHumanApproval: normalized.requiresHumanApproval,
|
|
2073
|
+
proofBacked: normalized.proofBacked,
|
|
2074
|
+
businessProofReady: normalized.businessProofReady,
|
|
2075
|
+
releaseReady: normalized.releaseReady,
|
|
2076
|
+
diagnosisReady: normalized.diagnosisReady,
|
|
2077
|
+
issueClassProbePlanReady: normalized.issueClassProbePlanReady,
|
|
2078
|
+
clarificationRequired: normalized.clarificationRequired,
|
|
2079
|
+
blockers: Array.from(new Set(__spreadArray(__spreadArray([], __read(normalized.blockers), false), __read(validation.blockers), false))),
|
|
2080
|
+
requiredEvidence: normalized.requiredEvidence,
|
|
2081
|
+
nextCommands: normalized.nextCommands,
|
|
2082
|
+
forbiddenActions: normalized.forbiddenActions
|
|
2083
|
+
}
|
|
2084
|
+
};
|
|
2085
|
+
}
|
|
2086
|
+
function supportNextActionContractObject(ticket, job, evidence) {
|
|
2087
|
+
var ticketAutomation = plainObject(ticket.automation);
|
|
2088
|
+
var ticketManager = plainObject(ticketAutomation.manager || ticket.manager);
|
|
2089
|
+
var autonomousDecision = plainObject(job.supportV5AutonomousDecision
|
|
2090
|
+
|| job.support_v5_autonomous_decision
|
|
2091
|
+
|| evidence.supportV5AutonomousDecision
|
|
2092
|
+
|| evidence.support_v5_autonomous_decision
|
|
2093
|
+
|| ticket.supportV5AutonomousDecision
|
|
2094
|
+
|| ticket.support_v5_autonomous_decision);
|
|
2095
|
+
return evidenceObject(autonomousDecision.nextActionContract, autonomousDecision.next_action_contract, job.supportV5NextActionContract, job.support_v5_next_action_contract, job.nextActionContract, job.next_action_contract, evidence.supportV5NextActionContract, evidence.support_v5_next_action_contract, evidence.nextActionContract, evidence.next_action_contract, ticket.supportV5NextActionContract, ticket.support_v5_next_action_contract, ticket.nextActionContract, ticket.next_action_contract, ticketManager.nextActionContract, ticketManager.next_action_contract);
|
|
2096
|
+
}
|
|
2097
|
+
function supportNextActionContractRequired(ticket, job, evidence) {
|
|
2098
|
+
var ticketAutomation = plainObject(ticket.automation);
|
|
2099
|
+
var ticketManager = plainObject(ticketAutomation.manager || ticket.manager);
|
|
2100
|
+
var workflowMarkers = [
|
|
2101
|
+
job.supportWorkflowMode,
|
|
2102
|
+
job.workflowMode,
|
|
2103
|
+
job.workflow_mode,
|
|
2104
|
+
job.supportWorkflowVersion,
|
|
2105
|
+
job.support_workflow_version,
|
|
2106
|
+
ticket.supportWorkflowMode,
|
|
2107
|
+
ticket.workflowMode,
|
|
2108
|
+
ticket.workflow_mode
|
|
2109
|
+
].map(function (value) { return cleanText(value, 80).toLowerCase(); });
|
|
2110
|
+
return workflowMarkers.some(function (value) { return value === 'support_v5' || value === 'v5'; })
|
|
2111
|
+
|| !!job.supportV5SupervisorState
|
|
2112
|
+
|| !!job.supportV5MicrotaskLedger
|
|
2113
|
+
|| !!job.supportV5StepHistory
|
|
2114
|
+
|| !!job.supportV5DiagnosisGate
|
|
2115
|
+
|| !!job.supportV5DiagnosisEvidencePack
|
|
2116
|
+
|| !!job.support_v5_supervisor_state
|
|
2117
|
+
|| !!job.support_v5_microtask_ledger
|
|
2118
|
+
|| !!job.support_v5_step_history
|
|
2119
|
+
|| !!job.support_v5_diagnosis_gate
|
|
2120
|
+
|| !!job.support_v5_diagnosis_evidence_pack
|
|
2121
|
+
|| !!job.supportRootCauseEntryContract
|
|
2122
|
+
|| !!job.support_root_cause_entry_contract
|
|
2123
|
+
|| !!evidence.supportV5AutonomousDecision
|
|
2124
|
+
|| !!evidence.support_v5_autonomous_decision
|
|
2125
|
+
|| !!evidence.rootCauseReadiness
|
|
2126
|
+
|| !!evidence.root_cause_readiness
|
|
2127
|
+
|| !!ticketManager.root_cause_entry_contract
|
|
2128
|
+
|| !!ticketManager.rootCauseEntryContract
|
|
2129
|
+
|| !!ticketManager.last_watchdog_decision;
|
|
2130
|
+
}
|
|
2131
|
+
function supportNextActionContractMetadata(contract) {
|
|
2132
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
2133
|
+
var decisionBasis = plainObject(contract.decisionBasis || contract.decision_basis);
|
|
2134
|
+
var costRisk = plainObject(contract.costRisk || contract.cost_risk);
|
|
2135
|
+
var source = {
|
|
2136
|
+
contractId: cleanText(contract.contractId || contract.contract_id, 200),
|
|
2137
|
+
action: cleanText(contract.action, 160),
|
|
2138
|
+
label: cleanText(contract.label, 300),
|
|
2139
|
+
primaryCommand: cleanText(contract.primaryCommand || contract.primary_command, 240),
|
|
2140
|
+
lane: cleanText(contract.lane, 120),
|
|
2141
|
+
stepType: cleanText(contract.stepType || contract.step_type, 120),
|
|
2142
|
+
safeToAutoRun: booleanFlag((_a = contract.safeToAutoRun) !== null && _a !== void 0 ? _a : contract.safe_to_auto_run),
|
|
2143
|
+
requiresHumanApproval: booleanFlag((_b = contract.requiresHumanApproval) !== null && _b !== void 0 ? _b : contract.requires_human_approval),
|
|
2144
|
+
canRunWithoutCodexMonitor: booleanFlag((_c = contract.canRunWithoutCodexMonitor) !== null && _c !== void 0 ? _c : contract.can_run_without_codex_monitor),
|
|
2145
|
+
codexFallbackRequired: booleanFlag((_d = contract.codexFallbackRequired) !== null && _d !== void 0 ? _d : contract.codex_fallback_required),
|
|
2146
|
+
codexFallbackReason: cleanText(contract.codexFallbackReason || contract.codex_fallback_reason, 1000),
|
|
2147
|
+
rootCauseFirstSatisfied: booleanFlag((_e = contract.rootCauseFirstSatisfied) !== null && _e !== void 0 ? _e : contract.root_cause_first_satisfied),
|
|
2148
|
+
preconditions: cleanStringList(contract.preconditions, 40, 500),
|
|
2149
|
+
expectedStateTransition: cleanText(contract.expectedStateTransition || contract.expected_state_transition, 1000),
|
|
2150
|
+
successEvidence: cleanStringList(contract.successEvidence || contract.success_evidence, 40, 500),
|
|
2151
|
+
stopConditions: cleanStringList(contract.stopConditions || contract.stop_conditions, 40, 500),
|
|
2152
|
+
forbiddenActions: cleanStringList(contract.forbiddenActions || contract.forbidden_actions, 40, 500),
|
|
2153
|
+
ownerFiles: cleanStringList(contract.ownerFiles || contract.owner_files || decisionBasis.ownerFiles || decisionBasis.owner_files, 40, 500),
|
|
2154
|
+
blockers: cleanStringList(contract.blockers, 40, 500),
|
|
2155
|
+
nextCommands: cleanStringList(contract.nextCommands || contract.next_commands, 40, 500),
|
|
2156
|
+
costRisk: {
|
|
2157
|
+
level: cleanText(costRisk.level || contract.costRiskLevel || contract.cost_risk_level, 80),
|
|
2158
|
+
estimatedUsd: numberValue((_h = (_g = (_f = costRisk.estimatedUsd) !== null && _f !== void 0 ? _f : costRisk.estimated_usd) !== null && _g !== void 0 ? _g : contract.estimatedUsd) !== null && _h !== void 0 ? _h : contract.estimated_usd),
|
|
2159
|
+
reason: cleanText(costRisk.reason, 800)
|
|
2160
|
+
},
|
|
2161
|
+
diagnosisValid: booleanFlag((_j = decisionBasis.diagnosisValid) !== null && _j !== void 0 ? _j : decisionBasis.diagnosis_valid),
|
|
2162
|
+
ownerFilesReady: booleanFlag((_k = decisionBasis.ownerFilesReady) !== null && _k !== void 0 ? _k : decisionBasis.owner_files_ready),
|
|
2163
|
+
proofPlanReady: booleanFlag((_l = decisionBasis.proofPlanReady) !== null && _l !== void 0 ? _l : decisionBasis.proof_plan_ready),
|
|
2164
|
+
businessProofReady: booleanFlag((_m = decisionBasis.businessProofReady) !== null && _m !== void 0 ? _m : decisionBasis.business_proof_ready),
|
|
2165
|
+
evidenceFreshnessStatus: cleanText(decisionBasis.evidenceFreshnessStatus || decisionBasis.evidence_freshness_status, 120),
|
|
2166
|
+
evidenceStrength: cleanText(decisionBasis.evidenceStrength || decisionBasis.evidence_strength, 120),
|
|
2167
|
+
failureClass: cleanText(decisionBasis.failureClass || decisionBasis.failure_class, 120),
|
|
2168
|
+
blockerFingerprint: cleanText(decisionBasis.blockerFingerprint || decisionBasis.blocker_fingerprint, 200),
|
|
2169
|
+
evidenceHash: cleanText(decisionBasis.evidenceHash || decisionBasis.evidence_hash, 200),
|
|
2170
|
+
sameFailureCount: numberValue((_o = decisionBasis.sameFailureCount) !== null && _o !== void 0 ? _o : decisionBasis.same_failure_count),
|
|
2171
|
+
preflightReady: booleanFlag((_p = decisionBasis.preflightReady) !== null && _p !== void 0 ? _p : decisionBasis.preflight_ready),
|
|
2172
|
+
preflightStatus: cleanText(decisionBasis.preflightStatus || decisionBasis.preflight_status, 120),
|
|
2173
|
+
preflightFailureClass: cleanText(decisionBasis.preflightFailureClass || decisionBasis.preflight_failure_class, 120),
|
|
2174
|
+
preflightEvidenceHash: cleanText(decisionBasis.preflightEvidenceHash || decisionBasis.preflight_evidence_hash, 200),
|
|
2175
|
+
hotfixCommitRequired: booleanFlag((_s = (_r = (_q = decisionBasis.hotfixCommitRequired) !== null && _q !== void 0 ? _q : decisionBasis.hotfix_commit_required) !== null && _r !== void 0 ? _r : contract.hotfixCommitRequired) !== null && _s !== void 0 ? _s : contract.hotfix_commit_required),
|
|
2176
|
+
liveHotfixBlockedUntilCommit: booleanFlag((_v = (_u = (_t = decisionBasis.liveHotfixBlockedUntilCommit) !== null && _t !== void 0 ? _t : decisionBasis.live_hotfix_blocked_until_commit) !== null && _u !== void 0 ? _u : contract.liveHotfixBlockedUntilCommit) !== null && _v !== void 0 ? _v : contract.live_hotfix_blocked_until_commit)
|
|
2177
|
+
};
|
|
2178
|
+
return source;
|
|
2179
|
+
}
|
|
2180
|
+
function supportNextActionContractGate(contract, now, required) {
|
|
2181
|
+
if (required === void 0) { required = false; }
|
|
2182
|
+
if (!contract || !Object.keys(contract).length) {
|
|
2183
|
+
if (!required) {
|
|
2184
|
+
return undefined;
|
|
2185
|
+
}
|
|
2186
|
+
var blocker = 'Support V5 run is missing a validated next-action contract, so the manager cannot prove one safe primary action without external Codex monitoring.';
|
|
2187
|
+
return {
|
|
2188
|
+
key: 'support_next_action_contract',
|
|
2189
|
+
label: 'Support next-action contract',
|
|
2190
|
+
status: 'blocked',
|
|
2191
|
+
reason: blocker,
|
|
2192
|
+
evidenceRefs: [],
|
|
2193
|
+
recordedAt: isoNow(now),
|
|
2194
|
+
metadata: {
|
|
2195
|
+
required: true,
|
|
2196
|
+
missingContract: true,
|
|
2197
|
+
safeToAutoRun: false,
|
|
2198
|
+
canRunWithoutCodexMonitor: false,
|
|
2199
|
+
codexFallbackRequired: true,
|
|
2200
|
+
codexFallbackReason: 'missing_support_next_action_contract',
|
|
2201
|
+
blockers: [blocker],
|
|
2202
|
+
missingSafetyFlags: ['safeToAutoRun', 'canRunWithoutCodexMonitor', 'codexFallbackRequired']
|
|
2203
|
+
}
|
|
2204
|
+
};
|
|
2205
|
+
}
|
|
2206
|
+
var metadata = supportNextActionContractMetadata(contract);
|
|
2207
|
+
var blockers = cleanStringList(metadata.blockers, 40, 500);
|
|
2208
|
+
if (metadata.safeToAutoRun === false) {
|
|
2209
|
+
blockers.push('Next action contract marks the action unsafe for autonomous run.');
|
|
2210
|
+
}
|
|
2211
|
+
if (metadata.canRunWithoutCodexMonitor === false) {
|
|
2212
|
+
blockers.push('Next action requires Codex fallback/monitoring instead of manager-only execution.');
|
|
2213
|
+
}
|
|
2214
|
+
if (metadata.codexFallbackRequired === true) {
|
|
2215
|
+
blockers.push(metadata.codexFallbackReason || 'Next action contract requires Codex fallback.');
|
|
2216
|
+
}
|
|
2217
|
+
if (metadata.requiresHumanApproval === true) {
|
|
2218
|
+
blockers.push('Next action contract requires human approval.');
|
|
2219
|
+
}
|
|
2220
|
+
if (metadata.liveHotfixBlockedUntilCommit === true) {
|
|
2221
|
+
blockers.push('Live hotfix is blocked until the manager records and pushes the GitHub commit proof.');
|
|
2222
|
+
}
|
|
2223
|
+
var missingSafetyFlags = [
|
|
2224
|
+
metadata.safeToAutoRun === undefined ? 'safeToAutoRun' : '',
|
|
2225
|
+
metadata.canRunWithoutCodexMonitor === undefined ? 'canRunWithoutCodexMonitor' : '',
|
|
2226
|
+
metadata.codexFallbackRequired === undefined ? 'codexFallbackRequired' : ''
|
|
2227
|
+
].filter(Boolean);
|
|
2228
|
+
var status = blockers.length
|
|
2229
|
+
? 'blocked'
|
|
2230
|
+
: missingSafetyFlags.length
|
|
2231
|
+
? 'warn'
|
|
2232
|
+
: 'pass';
|
|
2233
|
+
var actionLabel = metadata.label || metadata.action || metadata.primaryCommand || 'support next action';
|
|
2234
|
+
return {
|
|
2235
|
+
key: 'support_next_action_contract',
|
|
2236
|
+
label: 'Support next-action contract',
|
|
2237
|
+
status: status,
|
|
2238
|
+
reason: blockers.length
|
|
2239
|
+
? blockers.join(' ')
|
|
2240
|
+
: missingSafetyFlags.length
|
|
2241
|
+
? "Support next-action contract is present for ".concat(actionLabel, ", but missing explicit safety flags: ").concat(missingSafetyFlags.join(', '), ".")
|
|
2242
|
+
: "Support next-action contract allows ".concat(actionLabel, " without Codex monitoring."),
|
|
2243
|
+
evidenceRefs: cleanStringList(__spreadArray(__spreadArray(__spreadArray([], __read(metadata.successEvidence), false), __read(metadata.preconditions), false), __read(metadata.stopConditions), false), 40, 500),
|
|
2244
|
+
recordedAt: isoNow(now || contract.createdAt || contract.created_at || contract.recordedAt || contract.recorded_at),
|
|
2245
|
+
metadata: __assign(__assign({}, metadata), { blockers: blockers, missingSafetyFlags: missingSafetyFlags })
|
|
2246
|
+
};
|
|
2247
|
+
}
|
|
2248
|
+
function supportManagerExecutionPacketObject(ticket, job, evidence, nextActionContract) {
|
|
2249
|
+
var ticketAutomation = plainObject(ticket.automation);
|
|
2250
|
+
var ticketManager = plainObject(ticketAutomation.manager || ticket.manager);
|
|
2251
|
+
var autonomousDecision = plainObject(job.supportV5AutonomousDecision
|
|
2252
|
+
|| job.support_v5_autonomous_decision
|
|
2253
|
+
|| evidence.supportV5AutonomousDecision
|
|
2254
|
+
|| evidence.support_v5_autonomous_decision
|
|
2255
|
+
|| ticket.supportV5AutonomousDecision
|
|
2256
|
+
|| ticket.support_v5_autonomous_decision);
|
|
2257
|
+
var explicitPacket = evidenceObject(autonomousDecision.managerExecutionPacket, autonomousDecision.manager_execution_packet, job.supportV5ManagerExecutionPacket, job.support_v5_manager_execution_packet, job.managerExecutionPacket, job.manager_execution_packet, evidence.supportV5ManagerExecutionPacket, evidence.support_v5_manager_execution_packet, evidence.managerExecutionPacket, evidence.manager_execution_packet, ticket.supportV5ManagerExecutionPacket, ticket.support_v5_manager_execution_packet, ticket.managerExecutionPacket, ticket.manager_execution_packet, ticketManager.managerExecutionPacket, ticketManager.manager_execution_packet);
|
|
2258
|
+
if (Object.keys(explicitPacket).length) {
|
|
2259
|
+
return explicitPacket;
|
|
2260
|
+
}
|
|
2261
|
+
if (nextActionContract && Object.keys(nextActionContract).length) {
|
|
2262
|
+
try {
|
|
2263
|
+
return (0, support_runner_v5_1.buildResolveIOSupportManagerExecutionPacket)(nextActionContract);
|
|
2264
|
+
}
|
|
2265
|
+
catch (_a) {
|
|
2266
|
+
return {};
|
|
2267
|
+
}
|
|
2268
|
+
}
|
|
2269
|
+
return {};
|
|
2270
|
+
}
|
|
2271
|
+
function supportManagerExecutionPacketMetadata(packet) {
|
|
2272
|
+
var _a, _b, _c, _d;
|
|
2273
|
+
var validation = plainObject(packet.validation);
|
|
2274
|
+
var validationBlockers = cleanStringList(validation.blockers, 40, 500);
|
|
2275
|
+
var directBlockers = cleanStringList(packet.blockers, 40, 500);
|
|
2276
|
+
return {
|
|
2277
|
+
packetId: cleanText(packet.packetId || packet.packet_id, 200),
|
|
2278
|
+
status: cleanText(packet.status, 120),
|
|
2279
|
+
action: cleanText(packet.action, 160),
|
|
2280
|
+
label: cleanText(packet.label, 300),
|
|
2281
|
+
primaryCommand: cleanText(packet.primaryCommand || packet.primary_command, 240),
|
|
2282
|
+
lane: cleanText(packet.lane, 120),
|
|
2283
|
+
stepType: cleanText(packet.stepType || packet.step_type, 120),
|
|
2284
|
+
executeNow: booleanFlag((_a = packet.executeNow) !== null && _a !== void 0 ? _a : packet.execute_now),
|
|
2285
|
+
canRunWithoutCodexMonitor: booleanFlag((_b = packet.canRunWithoutCodexMonitor) !== null && _b !== void 0 ? _b : packet.can_run_without_codex_monitor),
|
|
2286
|
+
codexFallbackRequired: booleanFlag((_c = packet.codexFallbackRequired) !== null && _c !== void 0 ? _c : packet.codex_fallback_required),
|
|
2287
|
+
retryScope: cleanText(packet.retryScope || packet.retry_scope, 120),
|
|
2288
|
+
maxAttemptsBeforeFreshEvidence: numberValue((_d = packet.maxAttemptsBeforeFreshEvidence) !== null && _d !== void 0 ? _d : packet.max_attempts_before_fresh_evidence),
|
|
2289
|
+
costRisk: cleanText(packet.costRisk || packet.cost_risk, 120),
|
|
2290
|
+
proofRequiredBeforeContinuation: cleanStringList(packet.proofRequiredBeforeContinuation || packet.proof_required_before_continuation, 40, 500),
|
|
2291
|
+
expectedStateTransition: cleanText(packet.expectedStateTransition || packet.expected_state_transition, 1000),
|
|
2292
|
+
stopConditions: cleanStringList(packet.stopConditions || packet.stop_conditions, 40, 500),
|
|
2293
|
+
forbiddenActions: cleanStringList(packet.forbiddenActions || packet.forbidden_actions, 40, 500),
|
|
2294
|
+
ownerFiles: cleanStringList(packet.ownerFiles || packet.owner_files, 40, 500),
|
|
2295
|
+
nextCommands: cleanStringList(packet.nextCommands || packet.next_commands, 40, 500),
|
|
2296
|
+
blockers: Array.from(new Set(__spreadArray(__spreadArray([], __read(directBlockers), false), __read(validationBlockers), false))).slice(0, 40),
|
|
2297
|
+
validation: {
|
|
2298
|
+
valid: booleanFlag(validation.valid),
|
|
2299
|
+
status: cleanText(validation.status, 120),
|
|
2300
|
+
blockers: validationBlockers,
|
|
2301
|
+
warnings: cleanStringList(validation.warnings, 40, 500)
|
|
2302
|
+
},
|
|
2303
|
+
createdAt: cleanText(packet.createdAt || packet.created_at, 120)
|
|
2304
|
+
};
|
|
2305
|
+
}
|
|
2306
|
+
function supportManagerExecutionPacketGate(packet, now, required) {
|
|
2307
|
+
if (required === void 0) { required = false; }
|
|
2308
|
+
if (!packet || !Object.keys(packet).length) {
|
|
2309
|
+
if (!required) {
|
|
2310
|
+
return undefined;
|
|
2311
|
+
}
|
|
2312
|
+
var blocker = 'Support V5 run is missing a manager execution packet, so the console cannot prove the next action can execute without side Codex monitoring.';
|
|
2313
|
+
return {
|
|
2314
|
+
key: 'support_manager_execution_packet',
|
|
2315
|
+
label: 'Support manager execution packet',
|
|
2316
|
+
status: 'blocked',
|
|
2317
|
+
reason: blocker,
|
|
2318
|
+
evidenceRefs: [],
|
|
2319
|
+
recordedAt: isoNow(now),
|
|
2320
|
+
metadata: {
|
|
2321
|
+
required: true,
|
|
2322
|
+
missingPacket: true,
|
|
2323
|
+
executeNow: false,
|
|
2324
|
+
canRunWithoutCodexMonitor: false,
|
|
2325
|
+
codexFallbackRequired: true,
|
|
2326
|
+
blockers: [blocker],
|
|
2327
|
+
validation: {
|
|
2328
|
+
valid: false,
|
|
2329
|
+
status: 'blocked',
|
|
2330
|
+
blockers: [blocker],
|
|
2331
|
+
warnings: []
|
|
2332
|
+
}
|
|
2333
|
+
}
|
|
2334
|
+
};
|
|
2335
|
+
}
|
|
2336
|
+
var metadata = supportManagerExecutionPacketMetadata(packet);
|
|
2337
|
+
var blockers = cleanStringList(metadata.blockers, 40, 500);
|
|
2338
|
+
if (metadata.validation.valid !== true) {
|
|
2339
|
+
blockers.push('Manager execution packet is missing validated next-action contract proof.');
|
|
2340
|
+
}
|
|
2341
|
+
if (metadata.codexFallbackRequired === true) {
|
|
2342
|
+
blockers.push('Manager execution packet still requires Codex fallback.');
|
|
2343
|
+
}
|
|
2344
|
+
if (metadata.canRunWithoutCodexMonitor === false) {
|
|
2345
|
+
blockers.push('Manager execution packet does not prove Codex-monitor independence.');
|
|
2346
|
+
}
|
|
2347
|
+
var status = blockers.length
|
|
2348
|
+
? 'blocked'
|
|
2349
|
+
: metadata.status === 'auto_ready' && metadata.executeNow === true
|
|
2350
|
+
? 'pass'
|
|
2351
|
+
: metadata.status === 'manual_required'
|
|
2352
|
+
? 'warn'
|
|
2353
|
+
: 'blocked';
|
|
2354
|
+
var actionLabel = metadata.label || metadata.action || metadata.primaryCommand || 'support manager action';
|
|
2355
|
+
return {
|
|
2356
|
+
key: 'support_manager_execution_packet',
|
|
2357
|
+
label: 'Support manager execution packet',
|
|
2358
|
+
status: status,
|
|
2359
|
+
reason: status === 'pass'
|
|
2360
|
+
? "Support manager execution packet allows ".concat(actionLabel, " without side Codex monitoring.")
|
|
2361
|
+
: status === 'warn'
|
|
2362
|
+
? "Support manager execution packet for ".concat(actionLabel, " requires a human decision before execution.")
|
|
2363
|
+
: (blockers.join(' ') || "Support manager execution packet for ".concat(actionLabel, " is not auto-ready.")),
|
|
2364
|
+
evidenceRefs: cleanStringList(__spreadArray(__spreadArray(__spreadArray([], __read(metadata.proofRequiredBeforeContinuation), false), [
|
|
2365
|
+
metadata.expectedStateTransition
|
|
2366
|
+
], false), __read(metadata.stopConditions), false), 40, 500),
|
|
2367
|
+
recordedAt: isoNow(now || metadata.createdAt),
|
|
2368
|
+
metadata: __assign(__assign({}, metadata), { blockers: blockers })
|
|
2369
|
+
};
|
|
2370
|
+
}
|
|
2371
|
+
function supportDiagnosisEvidencePackObject(ticket, job, evidence) {
|
|
2372
|
+
var ticketAutomation = plainObject(ticket.automation);
|
|
2373
|
+
var ticketManager = plainObject(ticketAutomation.manager || ticket.manager);
|
|
2374
|
+
return evidenceObject(job.supportV5DiagnosisEvidencePack, job.support_v5_diagnosis_evidence_pack, job.diagnosisEvidencePack, job.diagnosis_evidence_pack, evidence.supportV5DiagnosisEvidencePack, evidence.support_v5_diagnosis_evidence_pack, evidence.diagnosisEvidencePack, evidence.diagnosis_evidence_pack, ticket.supportV5DiagnosisEvidencePack, ticket.support_v5_diagnosis_evidence_pack, ticket.diagnosisEvidencePack, ticket.diagnosis_evidence_pack, ticketManager.diagnosisEvidencePack, ticketManager.diagnosis_evidence_pack);
|
|
2375
|
+
}
|
|
2376
|
+
function supportIssueClassProbePlanObject(ticket, job, evidence) {
|
|
2377
|
+
var ticketAutomation = plainObject(ticket.automation);
|
|
2378
|
+
var ticketManager = plainObject(ticketAutomation.manager || ticket.manager);
|
|
2379
|
+
var autonomousDecision = plainObject(job.supportV5AutonomousDecision
|
|
2380
|
+
|| job.support_v5_autonomous_decision
|
|
2381
|
+
|| evidence.supportV5AutonomousDecision
|
|
2382
|
+
|| evidence.support_v5_autonomous_decision
|
|
2383
|
+
|| ticket.supportV5AutonomousDecision
|
|
2384
|
+
|| ticket.support_v5_autonomous_decision);
|
|
2385
|
+
return evidenceObject(autonomousDecision.issueClassProbePlan, autonomousDecision.issue_class_probe_plan, job.supportV5IssueClassProbePlan, job.support_v5_issue_class_probe_plan, job.issueClassProbePlan, job.issue_class_probe_plan, evidence.supportV5IssueClassProbePlan, evidence.support_v5_issue_class_probe_plan, evidence.issueClassProbePlan, evidence.issue_class_probe_plan, ticket.supportV5IssueClassProbePlan, ticket.support_v5_issue_class_probe_plan, ticket.issueClassProbePlan, ticket.issue_class_probe_plan, ticketManager.issueClassProbePlan, ticketManager.issue_class_probe_plan);
|
|
2386
|
+
}
|
|
2387
|
+
function supportSimilarFixHintsObject(ticket, job, evidence) {
|
|
2388
|
+
var ticketAutomation = plainObject(ticket.automation);
|
|
2389
|
+
var ticketManager = plainObject(ticketAutomation.manager || ticket.manager);
|
|
2390
|
+
return evidenceObject(job.supportRootCauseSimilarFixHints, job.support_root_cause_similar_fix_hints, job.similarFixHints, job.similar_fix_hints, evidence.supportRootCauseSimilarFixHints, evidence.support_root_cause_similar_fix_hints, evidence.similarFixHints, evidence.similar_fix_hints, ticket.supportRootCauseSimilarFixHints, ticket.support_root_cause_similar_fix_hints, ticketManager.rootCauseSimilarFixHints, ticketManager.root_cause_similar_fix_hints);
|
|
2391
|
+
}
|
|
2392
|
+
function supportDiagnosisEvidencePackGate(pack, now) {
|
|
2393
|
+
if (!pack || !Object.keys(pack).length) {
|
|
2394
|
+
return undefined;
|
|
2395
|
+
}
|
|
2396
|
+
var statusText = cleanText(pack.status, 120);
|
|
2397
|
+
var diagnosisValid = pack.diagnosisValid === true || pack.diagnosis_valid === true;
|
|
2398
|
+
var validationBlockers = cleanStringList(pack.validationBlockers || pack.validation_blockers, 40, 500);
|
|
2399
|
+
var similarSelection = plainObject(pack.similarCaseSelection || pack.similar_case_selection);
|
|
2400
|
+
var rankedHints = asArray(similarSelection.ranked);
|
|
2401
|
+
var gateStatus = diagnosisValid || statusText === 'diagnosis_ready'
|
|
2402
|
+
? 'pass'
|
|
2403
|
+
: statusText === 'blocked'
|
|
2404
|
+
? 'blocked'
|
|
2405
|
+
: 'warn';
|
|
2406
|
+
return {
|
|
2407
|
+
key: 'support_diagnosis_evidence_pack',
|
|
2408
|
+
label: 'Support diagnosis evidence pack',
|
|
2409
|
+
status: gateStatus,
|
|
2410
|
+
reason: gateStatus === 'pass'
|
|
2411
|
+
? 'Support diagnosis evidence pack has a valid root-cause diagnosis and advisory similar-fix context.'
|
|
2412
|
+
: validationBlockers.join('; ') || 'Support diagnosis evidence pack requires read-only root-cause evidence before repair.',
|
|
2413
|
+
evidenceRefs: cleanStringList(pack.requiredEvidence || pack.required_evidence, 30, 500),
|
|
2414
|
+
recordedAt: isoNow(now || pack.generatedAt || pack.generated_at),
|
|
2415
|
+
metadata: {
|
|
2416
|
+
packId: cleanText(pack.packId || pack.pack_id, 180),
|
|
2417
|
+
status: statusText,
|
|
2418
|
+
readOnly: pack.readOnly !== false && pack.read_only !== false,
|
|
2419
|
+
sourceEditsAllowed: pack.sourceEditsAllowed === true || pack.source_edits_allowed === true,
|
|
2420
|
+
rootCauseFirstRequired: pack.rootCauseFirstRequired !== false && pack.root_cause_first_required !== false,
|
|
2421
|
+
requiredOutputKey: cleanText(pack.requiredOutputKey || pack.required_output_key, 120),
|
|
2422
|
+
requiredFields: cleanStringList(pack.requiredFields || pack.required_fields, 20, 160),
|
|
2423
|
+
forbiddenActions: cleanStringList(pack.forbiddenActions || pack.forbidden_actions, 20, 500),
|
|
2424
|
+
diagnosisValid: diagnosisValid,
|
|
2425
|
+
diagnosisStatus: cleanText(pack.diagnosisStatus || pack.diagnosis_status, 120),
|
|
2426
|
+
validationBlockers: validationBlockers,
|
|
2427
|
+
issueClassHint: cleanText(pack.issueClassHint || pack.issue_class_hint, 120),
|
|
2428
|
+
ownerFileHints: cleanStringList(pack.ownerFileHints || pack.owner_file_hints, 20, 500),
|
|
2429
|
+
similarHintCount: rankedHints.length,
|
|
2430
|
+
similarHintsAdvisoryOnly: true,
|
|
2431
|
+
issueClassProbeCount: asArray(pack.issueClassProbeCatalog || pack.issue_class_probe_catalog).length
|
|
2432
|
+
}
|
|
2433
|
+
};
|
|
2434
|
+
}
|
|
2435
|
+
function supportIssueClassProbePlanGate(plan, diagnosisGate, now, required) {
|
|
2436
|
+
if (required === void 0) { required = false; }
|
|
2437
|
+
if (!plan || !Object.keys(plan).length) {
|
|
2438
|
+
if (!required) {
|
|
2439
|
+
return undefined;
|
|
2440
|
+
}
|
|
2441
|
+
var blocker = 'Support V5 run is missing IssueClassProbePlan, so business proof cannot be accepted from route-only or generic QA.';
|
|
2442
|
+
return {
|
|
2443
|
+
key: 'support_issue_class_probe_plan',
|
|
2444
|
+
label: 'Support issue-class probe plan',
|
|
2445
|
+
status: 'blocked',
|
|
2446
|
+
reason: blocker,
|
|
2447
|
+
evidenceRefs: [],
|
|
2448
|
+
recordedAt: isoNow(now),
|
|
2449
|
+
metadata: {
|
|
2450
|
+
required: true,
|
|
2451
|
+
missingPlan: true,
|
|
2452
|
+
issueClassProbePlanReady: false,
|
|
2453
|
+
acceptanceGate: 'aiqa_business_assertion',
|
|
2454
|
+
blockers: [blocker],
|
|
2455
|
+
falsePassBlockers: ['route load only', 'generic clickthrough only', 'scorecard-only pass']
|
|
2456
|
+
}
|
|
2457
|
+
};
|
|
2458
|
+
}
|
|
2459
|
+
var validation = (0, support_runner_v5_1.validateResolveIOSupportIssueClassProbePlan)(plan, diagnosisGate, now);
|
|
2460
|
+
var normalized = plainObject(validation.normalized || plan);
|
|
2461
|
+
var activeProbe = plainObject(validation.activeProbe || normalized.activeProbe || normalized.active_probe);
|
|
2462
|
+
var blockers = cleanStringList(validation.blockers || normalized.blockers, 40, 500);
|
|
2463
|
+
var requiredArtifacts = cleanStringList(normalized.requiredArtifacts
|
|
2464
|
+
|| normalized.required_artifacts
|
|
2465
|
+
|| activeProbe.required_artifacts, 30, 500);
|
|
2466
|
+
var falsePassBlockers = cleanStringList(normalized.falsePassBlockers
|
|
2467
|
+
|| normalized.false_pass_blockers
|
|
2468
|
+
|| activeProbe.false_pass_blockers, 30, 500);
|
|
2469
|
+
var status = validation.valid ? 'pass' : 'blocked';
|
|
2470
|
+
var issueClass = cleanText(normalized.issue_class || normalized.issueClass || activeProbe.issue_class, 120);
|
|
2471
|
+
var route = cleanText(activeProbe.route, 500);
|
|
2472
|
+
var action = cleanText(activeProbe.action, 1000);
|
|
2473
|
+
return {
|
|
2474
|
+
key: 'support_issue_class_probe_plan',
|
|
2475
|
+
label: 'Support issue-class probe plan',
|
|
2476
|
+
status: status,
|
|
2477
|
+
reason: validation.valid
|
|
2478
|
+
? "Support issue-class probe plan is ready for ".concat(issueClass || 'the diagnosed issue', " and requires AIQaBusinessAssertion proof.")
|
|
2479
|
+
: blockers.join('; ') || 'Support issue-class probe plan is incomplete.',
|
|
2480
|
+
evidenceRefs: requiredArtifacts,
|
|
2481
|
+
recordedAt: isoNow(now || normalized.generatedAt || normalized.generated_at),
|
|
2482
|
+
metadata: {
|
|
2483
|
+
planId: cleanText(normalized.planId || normalized.plan_id, 180),
|
|
2484
|
+
status: cleanText(validation.status || normalized.status, 120),
|
|
2485
|
+
issueClass: issueClass,
|
|
2486
|
+
diagnosisValid: normalized.diagnosisValid === true || normalized.diagnosis_valid === true,
|
|
2487
|
+
issueClassProbePlanReady: validation.valid === true && validation.status === 'ready',
|
|
2488
|
+
activeRoute: route,
|
|
2489
|
+
action: action,
|
|
2490
|
+
expectedEvidence: cleanText(activeProbe.expected_evidence || activeProbe.expectedEvidence, 1200),
|
|
2491
|
+
expectedBusinessProof: cleanText(activeProbe.expected_business_proof || activeProbe.expectedBusinessProof, 1200),
|
|
2492
|
+
acceptanceGate: cleanText(normalized.acceptanceGate || normalized.acceptance_gate || activeProbe.acceptance_gate, 120),
|
|
2493
|
+
requiredArtifacts: requiredArtifacts,
|
|
2494
|
+
falsePassBlockers: falsePassBlockers,
|
|
2495
|
+
blockers: blockers,
|
|
2496
|
+
activeProbe: {
|
|
2497
|
+
issueClass: issueClass,
|
|
2498
|
+
route: route,
|
|
2499
|
+
action: action,
|
|
2500
|
+
probeType: cleanText(activeProbe.probe_type || activeProbe.probeType, 120),
|
|
2501
|
+
failureClass: cleanText(activeProbe.failure_class || activeProbe.failureClass, 120),
|
|
2502
|
+
blocksAcceptanceWithoutBusinessAssertion: activeProbe.blocks_acceptance_without_business_assertion === true
|
|
2503
|
+
|| activeProbe.blocksAcceptanceWithoutBusinessAssertion === true
|
|
2504
|
+
}
|
|
2505
|
+
}
|
|
2506
|
+
};
|
|
2507
|
+
}
|
|
2508
|
+
function firstNonEmptyText(values, max) {
|
|
2509
|
+
var e_30, _a;
|
|
2510
|
+
if (max === void 0) { max = 1000; }
|
|
2511
|
+
try {
|
|
2512
|
+
for (var values_3 = __values(values), values_3_1 = values_3.next(); !values_3_1.done; values_3_1 = values_3.next()) {
|
|
2513
|
+
var value = values_3_1.value;
|
|
2514
|
+
var normalized = idText(value, max);
|
|
2515
|
+
if (normalized) {
|
|
2516
|
+
return normalized;
|
|
2517
|
+
}
|
|
2518
|
+
}
|
|
2519
|
+
}
|
|
2520
|
+
catch (e_30_1) { e_30 = { error: e_30_1 }; }
|
|
2521
|
+
finally {
|
|
2522
|
+
try {
|
|
2523
|
+
if (values_3_1 && !values_3_1.done && (_a = values_3.return)) _a.call(values_3);
|
|
2524
|
+
}
|
|
2525
|
+
finally { if (e_30) throw e_30.error; }
|
|
2526
|
+
}
|
|
2527
|
+
return undefined;
|
|
2528
|
+
}
|
|
2529
|
+
function booleanFlag(value) {
|
|
2530
|
+
if (value === true || value === false) {
|
|
2531
|
+
return value;
|
|
2532
|
+
}
|
|
2533
|
+
if (typeof value === 'string') {
|
|
2534
|
+
var normalized = value.trim().toLowerCase();
|
|
2535
|
+
if (/^(true|yes|1|passed|pass|ready|safe)$/.test(normalized)) {
|
|
2536
|
+
return true;
|
|
2537
|
+
}
|
|
2538
|
+
if (/^(false|no|0|failed|fail|blocked|unsafe)$/.test(normalized)) {
|
|
2539
|
+
return false;
|
|
2540
|
+
}
|
|
2541
|
+
}
|
|
2542
|
+
return undefined;
|
|
2543
|
+
}
|
|
2544
|
+
function numberValue(value) {
|
|
2545
|
+
var parsed = Number(value);
|
|
2546
|
+
return Number.isFinite(parsed) ? parsed : undefined;
|
|
2547
|
+
}
|
|
2548
|
+
function buildAICoderQaEvidence(input) {
|
|
2549
|
+
var _a, _b, _c;
|
|
2550
|
+
var app = input.app || {};
|
|
2551
|
+
var job = input.job || {};
|
|
2552
|
+
var workflowMemory = plainObject(job.aiCoderV6WorkflowMemory
|
|
2553
|
+
|| job.ai_coder_v6_workflow_memory
|
|
2554
|
+
|| app.aiCoderV6WorkflowMemory
|
|
2555
|
+
|| app.ai_coder_v6_workflow_memory);
|
|
2556
|
+
var evidence = mergeEvidenceRecords(job.qaEvidence, job.qa_evidence, app.qaEvidence, app.qa_evidence, input.qaEvidence);
|
|
2557
|
+
evidence.workflowQaRows = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(asArray(workflowMemory.workflowQaRows)), false), __read(asArray(workflowMemory.workflow_qa_rows)), false), __read(asArray(job.workflowQaRows)), false), __read(asArray(job.workflow_qa_rows)), false), __read(asArray(app.workflowQaRows)), false), __read(asArray(app.workflow_qa_rows)), false), __read(asArray(evidence.workflowQaRows)), false), __read(asArray(evidence.workflow_qa_rows)), false);
|
|
2558
|
+
evidence.businessAssertions = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(asArray(job.aiQaBusinessAssertions)), false), __read(asArray(job.ai_qa_business_assertions)), false), __read(asArray(job.businessAssertions)), false), __read(asArray(job.business_assertions)), false), __read(asArray(app.businessAssertions)), false), __read(asArray(app.business_assertions)), false), __read(asArray(evidence.businessAssertions)), false), __read(asArray(evidence.business_assertions)), false);
|
|
2559
|
+
evidence.routeProbes = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(asArray(job.workflowProbes)), false), __read(asArray(job.workflow_probes)), false), __read(asArray(evidence.routeProbes)), false), __read(asArray(evidence.route_probes)), false);
|
|
2560
|
+
evidence.artifactPaths = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(asArray(workflowMemory.businessProofArtifacts)), false), __read(asArray(workflowMemory.business_proof_artifacts)), false), __read(asArray(job.artifactPaths)), false), __read(asArray(job.artifact_paths)), false), __read(asArray(app.artifactPaths)), false), __read(asArray(app.artifact_paths)), false), __read(asArray(evidence.artifactPaths)), false), __read(asArray(evidence.artifact_paths)), false);
|
|
2561
|
+
evidence.journeyContract = evidence.journeyContract
|
|
2562
|
+
|| evidence.journey_contract
|
|
2563
|
+
|| job.journeyContract
|
|
2564
|
+
|| job.journey_contract
|
|
2565
|
+
|| app.journeyContract
|
|
2566
|
+
|| app.journey_contract
|
|
2567
|
+
|| workflowMemory.journeyContract
|
|
2568
|
+
|| workflowMemory.journey_contract;
|
|
2569
|
+
evidence.journeyContractMarkdown = evidence.journeyContractMarkdown
|
|
2570
|
+
|| evidence.journey_contract_markdown
|
|
2571
|
+
|| job.journeyContractMarkdown
|
|
2572
|
+
|| job.journey_contract_markdown
|
|
2573
|
+
|| app.journeyContractMarkdown
|
|
2574
|
+
|| app.journey_contract_markdown;
|
|
2575
|
+
evidence.journeyContractPath = firstNonEmptyText([
|
|
2576
|
+
evidence.journeyContractPath,
|
|
2577
|
+
evidence.journey_contract_path,
|
|
2578
|
+
workflowMemory.journeyContractPath,
|
|
2579
|
+
workflowMemory.journey_contract_path,
|
|
2580
|
+
job.journeyContractPath,
|
|
2581
|
+
job.journey_contract_path,
|
|
2582
|
+
app.journeyContractPath,
|
|
2583
|
+
app.journey_contract_path
|
|
2584
|
+
], 500) || 'docs/APP_JOURNEY_CONTRACT.md';
|
|
2585
|
+
evidence.deployStatus = firstNonEmptyText([
|
|
2586
|
+
evidence.deployStatus,
|
|
2587
|
+
evidence.deploy_status,
|
|
2588
|
+
job.deployStatus,
|
|
2589
|
+
job.deploy_status,
|
|
2590
|
+
job.testDeployStatus,
|
|
2591
|
+
job.test_deploy_status,
|
|
2592
|
+
app.deployStatus,
|
|
2593
|
+
app.deploy_status
|
|
2594
|
+
], 160);
|
|
2595
|
+
evidence.publishStatus = firstNonEmptyText([
|
|
2596
|
+
evidence.publishStatus,
|
|
2597
|
+
evidence.publish_status,
|
|
2598
|
+
evidence.pullRequestStatus,
|
|
2599
|
+
evidence.pull_request_status,
|
|
2600
|
+
job.publishStatus,
|
|
2601
|
+
job.publish_status,
|
|
2602
|
+
job.pullRequestStatus,
|
|
2603
|
+
job.pull_request_status,
|
|
2604
|
+
app.publishStatus,
|
|
2605
|
+
app.publish_status
|
|
2606
|
+
], 160);
|
|
2607
|
+
evidence.sampleDataStatus = firstNonEmptyText([
|
|
2608
|
+
evidence.sampleDataStatus,
|
|
2609
|
+
evidence.sample_data_status,
|
|
2610
|
+
job.sampleDataStatus,
|
|
2611
|
+
job.sample_data_status,
|
|
2612
|
+
app.sampleDataStatus,
|
|
2613
|
+
app.sample_data_status
|
|
2614
|
+
], 160) || statusFromBoolean((_c = (_b = (_a = evidence.sampleDataReady) !== null && _a !== void 0 ? _a : evidence.hasSampleData) !== null && _b !== void 0 ? _b : job.sampleDataReady) !== null && _c !== void 0 ? _c : app.sampleDataReady);
|
|
2615
|
+
return evidence;
|
|
2616
|
+
}
|
|
2617
|
+
function normalizeAICoderWorkflowProofReadiness(value, now) {
|
|
2618
|
+
if (!value || !Object.keys(value).length) {
|
|
2619
|
+
return undefined;
|
|
2620
|
+
}
|
|
2621
|
+
var ready = value.ready === true;
|
|
2622
|
+
var status = cleanText(value.status, 120) || (ready ? 'ready' : 'blocked');
|
|
2623
|
+
return {
|
|
2624
|
+
ready: ready,
|
|
2625
|
+
status: status,
|
|
2626
|
+
reason: cleanText(value.reason || value.summary || status, 1200),
|
|
2627
|
+
blockers: cleanStringList(value.blockers, 40, 500),
|
|
2628
|
+
journeyContractValid: value.journeyContractValid === true || value.journey_contract_valid === true,
|
|
2629
|
+
primaryWorkflowId: cleanText(value.primaryWorkflowId || value.primary_workflow_id, 200),
|
|
2630
|
+
passedWorkflowRows: cleanStringList(value.passedWorkflowRows || value.passed_workflow_rows, 80, 300),
|
|
2631
|
+
missingWorkflowRows: cleanStringList(value.missingWorkflowRows || value.missing_workflow_rows, 80, 300),
|
|
2632
|
+
failedWorkflowRows: cleanStringList(value.failedWorkflowRows || value.failed_workflow_rows, 80, 300),
|
|
2633
|
+
passedBusinessAssertions: cleanStringList(value.passedBusinessAssertions || value.passed_business_assertions, 80, 500),
|
|
2634
|
+
routeOnly: value.routeOnly === true || value.route_only === true,
|
|
2635
|
+
scorecardOnly: value.scorecardOnly === true || value.scorecard_only === true,
|
|
2636
|
+
sampleDataReady: value.sampleDataReady === true || value.sample_data_ready === true,
|
|
2637
|
+
releaseBlockers: cleanStringList(value.releaseBlockers || value.release_blockers, 40, 500),
|
|
2638
|
+
artifactPaths: cleanStringList(value.artifactPaths || value.artifact_paths, 80, 500),
|
|
2639
|
+
workflowProofFingerprint: cleanText(value.workflowProofFingerprint || value.workflow_proof_fingerprint, 200),
|
|
2640
|
+
artifactFingerprint: cleanText(value.artifactFingerprint || value.artifact_fingerprint, 200),
|
|
2641
|
+
proofFreshness: cleanText(value.proofFreshness || value.proof_freshness, 80),
|
|
2642
|
+
nextAction: cleanText(value.nextAction || value.next_action, 1000),
|
|
2643
|
+
evaluatedAt: isoNow(now || value.evaluatedAt || value.evaluated_at || value.recordedAt || value.recorded_at)
|
|
2644
|
+
};
|
|
2645
|
+
}
|
|
2646
|
+
function aicoderJourneyContractValidationFromEvidence(evidence) {
|
|
2647
|
+
var journeyInput = evidence.journeyContract !== undefined && evidence.journeyContract !== null
|
|
2648
|
+
? evidence.journeyContract
|
|
2649
|
+
: evidence.journeyContractMarkdown;
|
|
2650
|
+
var hasJourneyInput = journeyInput !== undefined && journeyInput !== null && cleanText(journeyInput, 100).length > 0;
|
|
2651
|
+
if (!hasJourneyInput) {
|
|
2652
|
+
return {
|
|
2653
|
+
valid: false,
|
|
2654
|
+
contract: null,
|
|
2655
|
+
issues: [{
|
|
2656
|
+
code: 'missing_contract',
|
|
2657
|
+
path: cleanText(evidence.journeyContractPath, 500) || 'docs/APP_JOURNEY_CONTRACT.md',
|
|
2658
|
+
message: 'docs/APP_JOURNEY_CONTRACT.md with structured journey_contract JSON is required before AICoder build, workflow QA, wow UI, publish, or acceptance.',
|
|
2659
|
+
severity: 'error'
|
|
2660
|
+
}],
|
|
2661
|
+
workflowQaRows: [],
|
|
2662
|
+
primaryWorkflowId: ''
|
|
2663
|
+
};
|
|
2664
|
+
}
|
|
2665
|
+
return (0, aicoder_runner_v6_1.validateResolveIOAICoderJourneyContract)(journeyInput, {
|
|
2666
|
+
requireMarkdownEnvelope: typeof journeyInput === 'string'
|
|
2667
|
+
});
|
|
2668
|
+
}
|
|
2669
|
+
function aicoderJourneyContractGate(validation, evidence, now) {
|
|
2670
|
+
var errorIssues = validation.issues.filter(function (issue) { return issue.severity === 'error'; });
|
|
2671
|
+
var warningIssues = validation.issues.filter(function (issue) { return issue.severity === 'warning'; });
|
|
2672
|
+
var status = validation.valid
|
|
2673
|
+
? (warningIssues.length ? 'warn' : 'pass')
|
|
2674
|
+
: 'blocked';
|
|
2675
|
+
var path = cleanText(evidence.journeyContractPath, 500) || 'docs/APP_JOURNEY_CONTRACT.md';
|
|
2676
|
+
return {
|
|
2677
|
+
key: 'aicoder_journey_contract',
|
|
2678
|
+
label: 'AICoder journey contract',
|
|
2679
|
+
status: status,
|
|
2680
|
+
reason: validation.valid
|
|
2681
|
+
? (warningIssues.length
|
|
2682
|
+
? "Journey contract is valid with warnings: ".concat(warningIssues.map(function (issue) { return issue.message; }).slice(0, 3).join(' | '))
|
|
2683
|
+
: 'Journey contract validates first/next/last workflow, data story, completion states, and QA assertions.')
|
|
2684
|
+
: (errorIssues.map(function (issue) { return issue.message; }).slice(0, 5).join(' | ') || 'AICoder Journey Contract is missing or invalid.'),
|
|
2685
|
+
evidenceRefs: [path],
|
|
2686
|
+
recordedAt: isoNow(now),
|
|
2687
|
+
metadata: {
|
|
2688
|
+
path: path,
|
|
2689
|
+
valid: validation.valid,
|
|
2690
|
+
primaryWorkflowId: cleanText(validation.primaryWorkflowId, 200),
|
|
2691
|
+
workflowQaRowCount: validation.workflowQaRows.length,
|
|
2692
|
+
workflowQaCoverageTags: cleanStringList(validation.workflowQaRows.flatMap(function (row) { return asArray(row.coverageTags || row.coverage_tags); }), 80, 120),
|
|
2693
|
+
workflowQaProofKinds: cleanStringList(validation.workflowQaRows.map(function (row) { return row.proofKind || row.proof_kind; }), 80, 120),
|
|
2694
|
+
errorCount: errorIssues.length,
|
|
2695
|
+
warningCount: warningIssues.length,
|
|
2696
|
+
issueCodes: cleanStringList(validation.issues.map(function (issue) { return issue.code; }), 40, 120),
|
|
2697
|
+
issues: validation.issues.slice(0, 20).map(function (issue) { return ({
|
|
2698
|
+
code: cleanText(issue.code, 120),
|
|
2699
|
+
path: cleanText(issue.path, 500),
|
|
2700
|
+
severity: issue.severity,
|
|
2701
|
+
message: cleanText(issue.message, 800)
|
|
2702
|
+
}); }),
|
|
2703
|
+
blocksBuildUntilValid: !validation.valid,
|
|
2704
|
+
blocksWorkflowQaUntilValid: !validation.valid,
|
|
2705
|
+
blocksWowUiUntilWorkflowProof: !validation.valid,
|
|
2706
|
+
blocksPublishUntilWorkflowProof: !validation.valid,
|
|
2707
|
+
nextAction: validation.valid
|
|
2708
|
+
? 'Generate workflow QA rows from journey_contract.qa_assertions and execute the north-star workflow.'
|
|
2709
|
+
: 'Generate or repair docs/APP_JOURNEY_CONTRACT.md before app build, wow UI, publish, or acceptance.'
|
|
2710
|
+
}
|
|
2711
|
+
};
|
|
2712
|
+
}
|
|
2713
|
+
function aicoderWorkflowProofReadinessGate(readiness, now) {
|
|
2714
|
+
var status = readiness.ready
|
|
2715
|
+
? 'pass'
|
|
2716
|
+
: readiness.status === 'release_blocked' || readiness.status === 'journey_invalid' || readiness.status === 'sample_data_missing'
|
|
2717
|
+
? 'fail'
|
|
2718
|
+
: 'blocked';
|
|
2719
|
+
return {
|
|
2720
|
+
key: 'aicoder_workflow_proof_readiness',
|
|
2721
|
+
label: 'AICoder workflow proof readiness',
|
|
2722
|
+
status: status,
|
|
2723
|
+
reason: readiness.reason || readiness.blockers.join('; ') || readiness.status,
|
|
2724
|
+
evidenceRefs: readiness.artifactPaths,
|
|
2725
|
+
recordedAt: isoNow(now || readiness.evaluatedAt),
|
|
2726
|
+
metadata: {
|
|
2727
|
+
ready: readiness.ready,
|
|
2728
|
+
status: readiness.status,
|
|
2729
|
+
primaryWorkflowId: readiness.primaryWorkflowId,
|
|
2730
|
+
journeyContractValid: readiness.journeyContractValid,
|
|
2731
|
+
blockers: readiness.blockers,
|
|
2732
|
+
passedWorkflowRows: readiness.passedWorkflowRows,
|
|
2733
|
+
missingWorkflowRows: readiness.missingWorkflowRows,
|
|
2734
|
+
failedWorkflowRows: readiness.failedWorkflowRows,
|
|
2735
|
+
passedBusinessAssertions: readiness.passedBusinessAssertions,
|
|
2736
|
+
routeOnly: readiness.routeOnly,
|
|
2737
|
+
scorecardOnly: readiness.scorecardOnly,
|
|
2738
|
+
sampleDataReady: readiness.sampleDataReady,
|
|
2739
|
+
releaseBlockers: readiness.releaseBlockers,
|
|
2740
|
+
workflowProofFingerprint: readiness.workflowProofFingerprint,
|
|
2741
|
+
artifactFingerprint: readiness.artifactFingerprint,
|
|
2742
|
+
proofFreshness: readiness.proofFreshness,
|
|
2743
|
+
nextAction: readiness.nextAction
|
|
2744
|
+
}
|
|
2745
|
+
};
|
|
2746
|
+
}
|
|
2747
|
+
function aicoderWorkflowProofCheckpointObject(app, job, evidence) {
|
|
2748
|
+
var workflowMemory = plainObject(job.aiCoderV6WorkflowMemory
|
|
2749
|
+
|| job.ai_coder_v6_workflow_memory
|
|
2750
|
+
|| app.aiCoderV6WorkflowMemory
|
|
2751
|
+
|| app.ai_coder_v6_workflow_memory
|
|
2752
|
+
|| evidence.aiCoderV6WorkflowMemory
|
|
2753
|
+
|| evidence.ai_coder_v6_workflow_memory);
|
|
2754
|
+
var continuationDecision = plainObject(job.aicoderV6ContinuationDecision
|
|
2755
|
+
|| job.aiCoderV6ContinuationDecision
|
|
2756
|
+
|| job.aicoder_v6_continuation_decision
|
|
2757
|
+
|| job.ai_coder_v6_continuation_decision
|
|
2758
|
+
|| app.aicoderV6ContinuationDecision
|
|
2759
|
+
|| app.aiCoderV6ContinuationDecision
|
|
2760
|
+
|| app.aicoder_v6_continuation_decision
|
|
2761
|
+
|| evidence.aicoderV6ContinuationDecision
|
|
2762
|
+
|| evidence.aiCoderV6ContinuationDecision
|
|
2763
|
+
|| evidence.aicoder_v6_continuation_decision);
|
|
2764
|
+
return evidenceObject(continuationDecision.workflowProofCheckpoint, continuationDecision.workflow_proof_checkpoint, workflowMemory.workflowProofCheckpoint, workflowMemory.workflow_proof_checkpoint, job.workflowProofCheckpoint, job.workflow_proof_checkpoint, job.aicoderWorkflowProofCheckpoint, job.aicoder_workflow_proof_checkpoint, app.workflowProofCheckpoint, app.workflow_proof_checkpoint, evidence.workflowProofCheckpoint, evidence.workflow_proof_checkpoint, evidence.aicoderWorkflowProofCheckpoint, evidence.aicoder_workflow_proof_checkpoint);
|
|
2765
|
+
}
|
|
2766
|
+
function aicoderWorkflowProofCheckpointGate(checkpoint, now) {
|
|
2767
|
+
var _a, _b, _c, _d, _e;
|
|
2768
|
+
if (!checkpoint || !Object.keys(checkpoint).length) {
|
|
2769
|
+
return undefined;
|
|
2770
|
+
}
|
|
2771
|
+
var blocksProductRepairUntilJourneyContract = booleanFlag((_a = checkpoint.blocksProductRepairUntilJourneyContract) !== null && _a !== void 0 ? _a : checkpoint.blocks_product_repair_until_journey_contract) === true;
|
|
2772
|
+
var blocksPublishUntilWorkflowProof = booleanFlag((_b = checkpoint.blocksPublishUntilWorkflowProof) !== null && _b !== void 0 ? _b : checkpoint.blocks_publish_until_workflow_proof) === true;
|
|
2773
|
+
var blocksPublishUntilReleaseGate = booleanFlag((_c = checkpoint.blocksPublishUntilReleaseGate) !== null && _c !== void 0 ? _c : checkpoint.blocks_publish_until_release_gate) === true;
|
|
2774
|
+
var blocksWowUiUntilWorkflowProof = booleanFlag((_d = checkpoint.blocksWowUiUntilWorkflowProof) !== null && _d !== void 0 ? _d : checkpoint.blocks_wow_ui_until_workflow_proof) === true;
|
|
2775
|
+
var statusText = cleanText(checkpoint.status, 120);
|
|
2776
|
+
var required = booleanFlag(checkpoint.required) !== false;
|
|
2777
|
+
var blockers = cleanStringList(checkpoint.blockers, 40, 500);
|
|
2778
|
+
if (blocksProductRepairUntilJourneyContract) {
|
|
2779
|
+
blockers.push('Product repair is blocked until the journey contract is valid.');
|
|
2780
|
+
}
|
|
2781
|
+
if (blocksPublishUntilWorkflowProof) {
|
|
2782
|
+
blockers.push('Publish is blocked until workflow business proof passes.');
|
|
2783
|
+
}
|
|
2784
|
+
if (blocksPublishUntilReleaseGate) {
|
|
2785
|
+
blockers.push('Publish is blocked until release gate evidence passes.');
|
|
2786
|
+
}
|
|
2787
|
+
if (blocksWowUiUntilWorkflowProof) {
|
|
2788
|
+
blockers.push('Wow UI polish is blocked until workflow proof exists.');
|
|
2789
|
+
}
|
|
2790
|
+
var gateStatus = !required || statusText === 'ready_to_continue'
|
|
2791
|
+
? 'pass'
|
|
2792
|
+
: blockers.length
|
|
2793
|
+
? 'blocked'
|
|
2794
|
+
: 'warn';
|
|
2795
|
+
return {
|
|
2796
|
+
key: 'aicoder_workflow_proof_checkpoint',
|
|
2797
|
+
label: 'AICoder workflow proof checkpoint',
|
|
2798
|
+
status: gateStatus,
|
|
2799
|
+
reason: gateStatus === 'pass'
|
|
2800
|
+
? 'AICoder workflow checkpoint allows the next action.'
|
|
2801
|
+
: (blockers.join(' ') || cleanText(checkpoint.nextAction || checkpoint.next_action || statusText, 1200) || 'AICoder workflow checkpoint requires more proof before continuing.'),
|
|
2802
|
+
evidenceRefs: cleanStringList(__spreadArray(__spreadArray([], __read(asArray(checkpoint.requiredEvidence || checkpoint.required_evidence)), false), __read(asArray(checkpoint.requiredResetEvidence || checkpoint.required_reset_evidence)), false), 40, 500),
|
|
2803
|
+
recordedAt: isoNow(now || checkpoint.recordedAt || checkpoint.recorded_at || checkpoint.createdAt || checkpoint.created_at),
|
|
2804
|
+
metadata: {
|
|
2805
|
+
required: required,
|
|
2806
|
+
status: statusText,
|
|
2807
|
+
readinessStatus: cleanText(checkpoint.readinessStatus || checkpoint.readiness_status, 120),
|
|
2808
|
+
nextGate: cleanText(checkpoint.nextGate || checkpoint.next_gate, 120),
|
|
2809
|
+
nextAction: cleanText(checkpoint.nextAction || checkpoint.next_action, 1000),
|
|
2810
|
+
startingFailureClass: cleanText(checkpoint.startingFailureClass || checkpoint.starting_failure_class, 120),
|
|
2811
|
+
startingBlockerFingerprint: cleanText(checkpoint.startingBlockerFingerprint || checkpoint.starting_blocker_fingerprint, 200),
|
|
2812
|
+
startingEvidenceHash: cleanText(checkpoint.startingEvidenceHash || checkpoint.starting_evidence_hash, 200),
|
|
2813
|
+
workflowProofFingerprint: cleanText(checkpoint.workflowProofFingerprint || checkpoint.workflow_proof_fingerprint, 200),
|
|
2814
|
+
artifactFingerprint: cleanText(checkpoint.artifactFingerprint || checkpoint.artifact_fingerprint, 200),
|
|
2815
|
+
requiredEvidence: cleanStringList(checkpoint.requiredEvidence || checkpoint.required_evidence, 40, 500),
|
|
2816
|
+
requiredResetEvidence: cleanStringList(checkpoint.requiredResetEvidence || checkpoint.required_reset_evidence, 40, 500),
|
|
2817
|
+
successRequiresWorkflowBusinessProof: booleanFlag((_e = checkpoint.successRequiresWorkflowBusinessProof) !== null && _e !== void 0 ? _e : checkpoint.success_requires_workflow_business_proof) === true,
|
|
2818
|
+
blocksProductRepairUntilJourneyContract: blocksProductRepairUntilJourneyContract,
|
|
2819
|
+
blocksPublishUntilWorkflowProof: blocksPublishUntilWorkflowProof,
|
|
2820
|
+
blocksPublishUntilReleaseGate: blocksPublishUntilReleaseGate,
|
|
2821
|
+
blocksWowUiUntilWorkflowProof: blocksWowUiUntilWorkflowProof,
|
|
2822
|
+
blockers: blockers
|
|
2823
|
+
}
|
|
2824
|
+
};
|
|
2825
|
+
}
|
|
2826
|
+
function aicoderNextActionContractObject(app, job, evidence) {
|
|
2827
|
+
var continuationDecision = plainObject(job.aicoderV6ContinuationDecision
|
|
2828
|
+
|| job.aiCoderV6ContinuationDecision
|
|
2829
|
+
|| job.aicoder_v6_continuation_decision
|
|
2830
|
+
|| job.ai_coder_v6_continuation_decision
|
|
2831
|
+
|| app.aicoderV6ContinuationDecision
|
|
2832
|
+
|| app.aiCoderV6ContinuationDecision
|
|
2833
|
+
|| app.aicoder_v6_continuation_decision
|
|
2834
|
+
|| evidence.aicoderV6ContinuationDecision
|
|
2835
|
+
|| evidence.aiCoderV6ContinuationDecision
|
|
2836
|
+
|| evidence.aicoder_v6_continuation_decision);
|
|
2837
|
+
return evidenceObject(continuationDecision.nextActionContract, continuationDecision.next_action_contract, job.nextActionContract, job.next_action_contract, job.aicoderNextActionContract, job.aicoder_next_action_contract, job.aiCoderNextActionContract, job.ai_coder_next_action_contract, app.nextActionContract, app.next_action_contract, evidence.nextActionContract, evidence.next_action_contract, evidence.aicoderNextActionContract, evidence.aicoder_next_action_contract);
|
|
2838
|
+
}
|
|
2839
|
+
function aicoderNextActionContractGate(contract, now) {
|
|
2840
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
2841
|
+
if (!contract || !Object.keys(contract).length) {
|
|
2842
|
+
return undefined;
|
|
2843
|
+
}
|
|
2844
|
+
var safeToAutoRun = booleanFlag((_a = contract.safeToAutoRun) !== null && _a !== void 0 ? _a : contract.safe_to_auto_run) === true;
|
|
2845
|
+
var requiresHumanApproval = booleanFlag((_b = contract.requiresHumanApproval) !== null && _b !== void 0 ? _b : contract.requires_human_approval) === true;
|
|
2846
|
+
var canRunWithoutCodexMonitor = booleanFlag((_c = contract.canRunWithoutCodexMonitor) !== null && _c !== void 0 ? _c : contract.can_run_without_codex_monitor) === true;
|
|
2847
|
+
var codexFallbackRequired = booleanFlag((_d = contract.codexFallbackRequired) !== null && _d !== void 0 ? _d : contract.codex_fallback_required) === true;
|
|
2848
|
+
var sourceBlockers = cleanStringList(contract.blockers, 40, 500);
|
|
2849
|
+
var primaryCommand = cleanText(contract.primaryCommand || contract.primary_command, 200);
|
|
2850
|
+
var liveHotfixBlockedUntilCommit = booleanFlag((_g = (_f = (_e = contract.liveHotfixBlockedUntilCommit) !== null && _e !== void 0 ? _e : contract.live_hotfix_blocked_until_commit) !== null && _f !== void 0 ? _f : plainObject(contract.decisionBasis || contract.decision_basis).liveHotfixBlockedUntilCommit) !== null && _g !== void 0 ? _g : plainObject(contract.decisionBasis || contract.decision_basis).live_hotfix_blocked_until_commit) === true;
|
|
2851
|
+
var safetyBlockers = Array.from(new Set(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((safeToAutoRun ? [] : ['AICoder next action is not marked safe to auto-run.'])), false), __read((canRunWithoutCodexMonitor ? [] : ['AICoder next action requires Codex fallback/monitoring instead of manager-only execution.'])), false), __read((codexFallbackRequired ? [cleanText(contract.codexFallbackReason || contract.codex_fallback_reason, 1000) || 'AICoder next action contract requires Codex fallback.'] : [])), false), __read((requiresHumanApproval ? ['AICoder next action requires human approval.'] : [])), false), __read((liveHotfixBlockedUntilCommit ? ['Live AICoder hotfix is blocked until GitHub commit and push proof is recorded.'] : [])), false))).filter(Boolean).slice(0, 40);
|
|
2852
|
+
var contractBlockers = safetyBlockers.length
|
|
2853
|
+
? Array.from(new Set(__spreadArray(__spreadArray([], __read(sourceBlockers), false), __read(safetyBlockers), false))).slice(0, 40)
|
|
2854
|
+
: [];
|
|
2855
|
+
var missingSafetyFlags = [
|
|
2856
|
+
contract.safeToAutoRun === undefined && contract.safe_to_auto_run === undefined ? 'safeToAutoRun' : '',
|
|
2857
|
+
contract.canRunWithoutCodexMonitor === undefined && contract.can_run_without_codex_monitor === undefined ? 'canRunWithoutCodexMonitor' : '',
|
|
2858
|
+
contract.codexFallbackRequired === undefined && contract.codex_fallback_required === undefined ? 'codexFallbackRequired' : ''
|
|
2859
|
+
].filter(Boolean);
|
|
2860
|
+
var gateStatus = contractBlockers.length
|
|
2861
|
+
? 'blocked'
|
|
2862
|
+
: missingSafetyFlags.length
|
|
2863
|
+
? 'warn'
|
|
2864
|
+
: 'pass';
|
|
2865
|
+
return {
|
|
2866
|
+
key: 'aicoder_next_action_contract',
|
|
2867
|
+
label: 'AICoder next action contract',
|
|
2868
|
+
status: gateStatus,
|
|
2869
|
+
reason: gateStatus === 'pass'
|
|
2870
|
+
? "AICoder can run ".concat(primaryCommand || 'the next action', " without a Codex monitor.")
|
|
2871
|
+
: (contractBlockers.join(' ') || cleanText(contract.codexFallbackReason || contract.codex_fallback_reason || contract.expectedStateTransition || contract.expected_state_transition, 1200) || 'AICoder next action is not safe to run unattended.'),
|
|
2872
|
+
evidenceRefs: cleanStringList(__spreadArray(__spreadArray(__spreadArray([], __read(asArray(contract.preconditions)), false), __read(asArray(contract.successEvidence || contract.success_evidence)), false), __read(asArray(contract.stopConditions || contract.stop_conditions)), false), 40, 500),
|
|
2873
|
+
recordedAt: isoNow(now || contract.createdAt || contract.created_at || contract.recordedAt || contract.recorded_at),
|
|
2874
|
+
metadata: {
|
|
2875
|
+
contractId: cleanText(contract.contractId || contract.contract_id, 200),
|
|
2876
|
+
action: cleanText(contract.action, 120),
|
|
2877
|
+
label: cleanText(contract.label, 200),
|
|
2878
|
+
primaryCommand: primaryCommand,
|
|
2879
|
+
lane: cleanText(contract.lane, 120),
|
|
2880
|
+
stepType: cleanText(contract.stepType || contract.step_type, 120),
|
|
2881
|
+
safeToAutoRun: safeToAutoRun,
|
|
2882
|
+
requiresHumanApproval: requiresHumanApproval,
|
|
2883
|
+
canRunWithoutCodexMonitor: canRunWithoutCodexMonitor,
|
|
2884
|
+
codexFallbackRequired: codexFallbackRequired,
|
|
2885
|
+
codexFallbackReason: cleanText(contract.codexFallbackReason || contract.codex_fallback_reason, 1000),
|
|
2886
|
+
costRisk: cleanText(contract.costRisk || contract.cost_risk, 120),
|
|
2887
|
+
workflowFirstSatisfied: booleanFlag((_h = contract.workflowFirstSatisfied) !== null && _h !== void 0 ? _h : contract.workflow_first_satisfied) === true,
|
|
2888
|
+
hotfixCommitRequired: booleanFlag((_l = (_k = (_j = contract.hotfixCommitRequired) !== null && _j !== void 0 ? _j : contract.hotfix_commit_required) !== null && _k !== void 0 ? _k : plainObject(contract.decisionBasis || contract.decision_basis).hotfixCommitRequired) !== null && _l !== void 0 ? _l : plainObject(contract.decisionBasis || contract.decision_basis).hotfix_commit_required) === true,
|
|
2889
|
+
liveHotfixBlockedUntilCommit: liveHotfixBlockedUntilCommit,
|
|
2890
|
+
decisionBasis: plainObject(contract.decisionBasis || contract.decision_basis),
|
|
2891
|
+
preconditions: cleanStringList(contract.preconditions, 40, 500),
|
|
2892
|
+
expectedStateTransition: cleanText(contract.expectedStateTransition || contract.expected_state_transition, 1000),
|
|
2893
|
+
successEvidence: cleanStringList(contract.successEvidence || contract.success_evidence, 40, 500),
|
|
2894
|
+
requiredHotfixCommitProof: cleanStringList(contract.requiredHotfixCommitProof || contract.required_hotfix_commit_proof, 20, 240),
|
|
2895
|
+
stopConditions: cleanStringList(contract.stopConditions || contract.stop_conditions, 40, 500),
|
|
2896
|
+
forbiddenActions: cleanStringList(contract.forbiddenActions || contract.forbidden_actions, 40, 500),
|
|
2897
|
+
nextCommands: cleanStringList(contract.nextCommands || contract.next_commands, 40, 240),
|
|
2898
|
+
blockers: contractBlockers,
|
|
2899
|
+
contextBlockers: sourceBlockers,
|
|
2900
|
+
safetyBlockers: safetyBlockers,
|
|
2901
|
+
missingSafetyFlags: missingSafetyFlags,
|
|
2902
|
+
ownerFiles: cleanStringList(contract.ownerFiles || contract.owner_files, 40, 500)
|
|
2903
|
+
}
|
|
2904
|
+
};
|
|
2905
|
+
}
|
|
2906
|
+
function adapterStatusPassed(value) {
|
|
2907
|
+
var normalized = cleanText(value, 120).toLowerCase();
|
|
2908
|
+
return !!normalized && /(pass|passed|success|succeeded|ok|done|complete|completed|ready|saved|published|deployed)/i.test(normalized);
|
|
2909
|
+
}
|
|
2910
|
+
function applyAICoderWorkflowProofGate(qa, readiness, now) {
|
|
2911
|
+
if (readiness.ready
|
|
2912
|
+
|| readiness.status === 'release_blocked'
|
|
2913
|
+
|| qa.outcome === 'infra_failed'
|
|
2914
|
+
|| qa.outcome === 'compile_failed'
|
|
2915
|
+
|| qa.outcome === 'route_failed'
|
|
2916
|
+
|| qa.outcome === 'business_assertion_failed') {
|
|
2917
|
+
return qa;
|
|
2918
|
+
}
|
|
2919
|
+
var gate = aicoderWorkflowProofReadinessGate(readiness, now);
|
|
2920
|
+
return __assign(__assign({}, qa), { outcome: qa.routeProbes.some(function (probe) { return adapterStatusPassed(probe.status); })
|
|
2921
|
+
? 'route_only_pass'
|
|
2922
|
+
: 'incomplete', gateResults: __spreadArray(__spreadArray([], __read(qa.gateResults.filter(function (existing) { return !(existing.key === 'qa_business_assertion' && existing.status === 'pass'); })), false), [
|
|
2923
|
+
gate
|
|
2924
|
+
], false) });
|
|
2925
|
+
}
|
|
2926
|
+
function assistantQualityObject(input) {
|
|
2927
|
+
var _a, _b;
|
|
2928
|
+
var conversation = input.conversation || {};
|
|
2929
|
+
var latestAssistantMessage = __spreadArray([], __read(asArray(input.messages)), false).reverse()
|
|
2930
|
+
.find(function (message) { return /assistant/i.test(cleanText(message.role || message.authorRole || message.type, 80)); });
|
|
2931
|
+
return plainObject(input.answerQuality
|
|
2932
|
+
|| conversation.answerQuality
|
|
2933
|
+
|| conversation.answer_quality
|
|
2934
|
+
|| conversation.assistantAnswerQuality
|
|
2935
|
+
|| conversation.assistant_answer_quality
|
|
2936
|
+
|| (latestAssistantMessage === null || latestAssistantMessage === void 0 ? void 0 : latestAssistantMessage.answerQuality)
|
|
2937
|
+
|| (latestAssistantMessage === null || latestAssistantMessage === void 0 ? void 0 : latestAssistantMessage.answer_quality)
|
|
2938
|
+
|| ((_a = latestAssistantMessage === null || latestAssistantMessage === void 0 ? void 0 : latestAssistantMessage.metadata) === null || _a === void 0 ? void 0 : _a.answerQuality)
|
|
2939
|
+
|| ((_b = latestAssistantMessage === null || latestAssistantMessage === void 0 ? void 0 : latestAssistantMessage.metadata) === null || _b === void 0 ? void 0 : _b.answer_quality));
|
|
2940
|
+
}
|
|
2941
|
+
function assistantConfidenceLevel(value) {
|
|
2942
|
+
var normalized = cleanText((value === null || value === void 0 ? void 0 : value.level) || (value === null || value === void 0 ? void 0 : value.confidenceLevel) || (value === null || value === void 0 ? void 0 : value.confidence_level) || value, 80).toLowerCase();
|
|
2943
|
+
if (/^high$/.test(normalized)) {
|
|
2944
|
+
return 'high';
|
|
2945
|
+
}
|
|
2946
|
+
if (/^medium$/.test(normalized)) {
|
|
2947
|
+
return 'medium';
|
|
2948
|
+
}
|
|
2949
|
+
if (/^low$/.test(normalized)) {
|
|
2950
|
+
return 'low';
|
|
2951
|
+
}
|
|
2952
|
+
return 'unknown';
|
|
2953
|
+
}
|
|
2954
|
+
function assistantQueryStatus(value) {
|
|
2955
|
+
var normalized = cleanText((value === null || value === void 0 ? void 0 : value.status) || (value === null || value === void 0 ? void 0 : value.queryStatus) || (value === null || value === void 0 ? void 0 : value.query_status) || value, 120).toLowerCase().replace(/[\s-]+/g, '_');
|
|
2956
|
+
if (/^(ok|success|answered|data_found|data)$/.test(normalized)) {
|
|
2957
|
+
return 'ok';
|
|
2958
|
+
}
|
|
2959
|
+
if (/^(no_data|no_results|empty|not_found)$/.test(normalized)) {
|
|
2960
|
+
return 'no_data';
|
|
2961
|
+
}
|
|
2962
|
+
if (/^(query_error|mongo_error|error|failed)$/.test(normalized)) {
|
|
2963
|
+
return 'query_error';
|
|
2964
|
+
}
|
|
2965
|
+
if (/^(permission_error|permission_denied|forbidden|unauthorized)$/.test(normalized)) {
|
|
2966
|
+
return 'permission_error';
|
|
2967
|
+
}
|
|
2968
|
+
return 'unknown';
|
|
2969
|
+
}
|
|
2970
|
+
function asObjectList(value) {
|
|
2971
|
+
return asArray(value).filter(function (entry) { return entry && typeof entry === 'object' && !Array.isArray(entry); });
|
|
2972
|
+
}
|
|
2973
|
+
function assistantEvidenceRefs(quality) {
|
|
2974
|
+
return cleanStringList(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(asArray(quality.evidenceRefs)), false), __read(asArray(quality.evidence_refs)), false), __read(asArray(quality.citationRefs)), false), __read(asArray(quality.citation_refs)), false), __read(asArray(quality.artifactPaths)), false), __read(asArray(quality.artifact_paths)), false), __read(asObjectList(quality.citations).map(function (citation) { return citation.path || citation.url || citation.id || citation.ref; })), false), __read(asObjectList(quality.evidence).map(function (entry) { return entry.path || entry.url || entry.id || entry.ref; })), false), 80, 500);
|
|
2975
|
+
}
|
|
2976
|
+
function assistantCitationRefs(quality) {
|
|
2977
|
+
return cleanStringList(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(asArray(quality.citationRefs)), false), __read(asArray(quality.citation_refs)), false), __read(asObjectList(quality.citations).map(function (citation) { return citation.path || citation.url || citation.id || citation.ref; })), false), __read(asObjectList(quality.evidence).map(function (entry) { return entry.citation || entry.ref || entry.path || entry.url; })), false), 80, 500);
|
|
2978
|
+
}
|
|
2979
|
+
function assistantQueryExecutions(quality) {
|
|
2980
|
+
var queryExecution = plainObject(quality.queryExecution || quality.query_execution);
|
|
2981
|
+
var toolResult = plainObject(quality.toolResult || quality.tool_result);
|
|
2982
|
+
return __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(asObjectList(quality.queryExecutions)), false), __read(asObjectList(quality.query_executions)), false), __read(asObjectList(quality.dataQueries)), false), __read(asObjectList(quality.data_queries)), false), __read(asObjectList(quality.toolResults)), false), __read(asObjectList(quality.tool_results)), false), __read(asObjectList(quality.mongoReads)), false), __read(asObjectList(quality.mongo_reads)), false), __read(asObjectList(quality.mongoAggregations)), false), __read(asObjectList(quality.mongo_aggregations)), false), __read((Object.keys(queryExecution).length ? [queryExecution] : [])), false), __read((Object.keys(toolResult).length ? [toolResult] : [])), false).filter(function (entry) { return Object.keys(entry).length; });
|
|
2983
|
+
}
|
|
2984
|
+
function assistantQueryEvidenceRefs(quality, executions) {
|
|
2985
|
+
if (executions === void 0) { executions = assistantQueryExecutions(quality); }
|
|
2986
|
+
return cleanStringList(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(asArray(quality.queryEvidenceRefs)), false), __read(asArray(quality.query_evidence_refs)), false), __read(asArray(quality.toolResultRefs)), false), __read(asArray(quality.tool_result_refs)), false), __read(asArray(quality.queryResultRefs)), false), __read(asArray(quality.query_result_refs)), false), __read(executions.map(function (execution) {
|
|
2987
|
+
return execution.id
|
|
2988
|
+
|| execution._id
|
|
2989
|
+
|| execution.ref
|
|
2990
|
+
|| execution.toolResultId
|
|
2991
|
+
|| execution.tool_result_id
|
|
2992
|
+
|| execution.toolCallId
|
|
2993
|
+
|| execution.tool_call_id
|
|
2994
|
+
|| execution.artifactPath
|
|
2995
|
+
|| execution.artifact_path
|
|
2996
|
+
|| execution.path
|
|
2997
|
+
|| execution.url;
|
|
2998
|
+
})), false), 80, 500);
|
|
2999
|
+
}
|
|
3000
|
+
function assistantNextActions(quality) {
|
|
3001
|
+
return cleanStringList(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(asArray(quality.nextActions)), false), __read(asArray(quality.next_actions)), false), __read(asArray(quality.recommendedActions)), false), __read(asArray(quality.recommended_actions)), false), 20, 500);
|
|
3002
|
+
}
|
|
3003
|
+
function normalizedIsoDay(value) {
|
|
3004
|
+
if (!value) {
|
|
3005
|
+
return '';
|
|
3006
|
+
}
|
|
3007
|
+
var date = value instanceof Date ? value : new Date(value);
|
|
3008
|
+
if (!Number.isFinite(date.getTime())) {
|
|
3009
|
+
return cleanText(value, 40).slice(0, 10);
|
|
3010
|
+
}
|
|
3011
|
+
return date.toISOString().slice(0, 10);
|
|
3012
|
+
}
|
|
3013
|
+
function assistantDateWindowObject(quality) {
|
|
3014
|
+
var _a, _b, _c;
|
|
3015
|
+
var dateWindow = plainObject(quality.dateWindow || quality.date_window);
|
|
3016
|
+
var nestedWindow = plainObject(((_b = (_a = quality.verification) === null || _a === void 0 ? void 0 : _a.metrics) === null || _b === void 0 ? void 0 : _b.window) || ((_c = quality.metrics) === null || _c === void 0 ? void 0 : _c.window));
|
|
3017
|
+
return Object.keys(dateWindow).length ? dateWindow : nestedWindow;
|
|
3018
|
+
}
|
|
3019
|
+
function collectMongoProjectionObjects(value, result) {
|
|
3020
|
+
var e_31, _a;
|
|
3021
|
+
if (result === void 0) { result = []; }
|
|
3022
|
+
if (!value || typeof value !== 'object') {
|
|
3023
|
+
return result;
|
|
3024
|
+
}
|
|
3025
|
+
if (Array.isArray(value)) {
|
|
3026
|
+
try {
|
|
3027
|
+
for (var value_3 = __values(value), value_3_1 = value_3.next(); !value_3_1.done; value_3_1 = value_3.next()) {
|
|
3028
|
+
var entry = value_3_1.value;
|
|
3029
|
+
collectMongoProjectionObjects(entry, result);
|
|
3030
|
+
}
|
|
3031
|
+
}
|
|
3032
|
+
catch (e_31_1) { e_31 = { error: e_31_1 }; }
|
|
3033
|
+
finally {
|
|
3034
|
+
try {
|
|
3035
|
+
if (value_3_1 && !value_3_1.done && (_a = value_3.return)) _a.call(value_3);
|
|
3036
|
+
}
|
|
3037
|
+
finally { if (e_31) throw e_31.error; }
|
|
3038
|
+
}
|
|
3039
|
+
return result;
|
|
3040
|
+
}
|
|
3041
|
+
if (value.projection && typeof value.projection === 'object' && !Array.isArray(value.projection)) {
|
|
3042
|
+
result.push(value.projection);
|
|
3043
|
+
}
|
|
3044
|
+
if (value.options && typeof value.options === 'object' && !Array.isArray(value.options) && value.options.projection) {
|
|
3045
|
+
collectMongoProjectionObjects({ projection: value.options.projection }, result);
|
|
3046
|
+
}
|
|
3047
|
+
if (value.query && typeof value.query === 'object') {
|
|
3048
|
+
collectMongoProjectionObjects(value.query, result);
|
|
3049
|
+
}
|
|
3050
|
+
if (value.mongoQuery && typeof value.mongoQuery === 'object') {
|
|
3051
|
+
collectMongoProjectionObjects(value.mongoQuery, result);
|
|
3052
|
+
}
|
|
3053
|
+
if (value.mongo_query && typeof value.mongo_query === 'object') {
|
|
3054
|
+
collectMongoProjectionObjects(value.mongo_query, result);
|
|
3055
|
+
}
|
|
3056
|
+
return result;
|
|
3057
|
+
}
|
|
3058
|
+
function projectionHasPositionalOperator(projection) {
|
|
3059
|
+
return Object.keys(projection || {}).some(function (key) { return /\.(?:\$|\$\[)|\.\$$/.test(key); });
|
|
3060
|
+
}
|
|
3061
|
+
function assistantQueryShapeLegal(quality) {
|
|
3062
|
+
if (quality.legalQueryShape === true || quality.legal_query_shape === true) {
|
|
3063
|
+
return true;
|
|
3064
|
+
}
|
|
3065
|
+
if (quality.legalQueryShape === false || quality.legal_query_shape === false || quality.illegalQueryShape === true || quality.illegal_query_shape === true) {
|
|
3066
|
+
return false;
|
|
3067
|
+
}
|
|
3068
|
+
var queryShape = plainObject(quality.queryShape || quality.query_shape);
|
|
3069
|
+
if (queryShape.legal === true || queryShape.status === 'pass') {
|
|
3070
|
+
return true;
|
|
3071
|
+
}
|
|
3072
|
+
if (queryShape.legal === false || queryShape.status === 'fail') {
|
|
3073
|
+
return false;
|
|
3074
|
+
}
|
|
3075
|
+
var projections = collectMongoProjectionObjects(quality);
|
|
3076
|
+
if (projections.some(projectionHasPositionalOperator)) {
|
|
3077
|
+
return false;
|
|
3078
|
+
}
|
|
3079
|
+
return true;
|
|
3080
|
+
}
|
|
3081
|
+
function assistantCorrectnessFailed(checks) {
|
|
3082
|
+
return checks
|
|
3083
|
+
.filter(function (check) {
|
|
3084
|
+
var status = cleanText(check.status || (check.passed === true ? 'pass' : check.passed === false ? 'fail' : ''), 80).toLowerCase();
|
|
3085
|
+
return /^(fail|failed|blocked|incorrect|wrong|error)$/.test(status);
|
|
3086
|
+
})
|
|
3087
|
+
.map(function (check) { return cleanText(check.assertion || check.name || check.case || check.reason || 'assistant correctness check failed', 300); })
|
|
3088
|
+
.slice(0, 20);
|
|
3089
|
+
}
|
|
3090
|
+
function evaluateAssistantAnswerQuality(input) {
|
|
3091
|
+
var _a, _b;
|
|
3092
|
+
if (input === void 0) { input = {}; }
|
|
3093
|
+
var quality = plainObject(input.answerQuality);
|
|
3094
|
+
var now = isoNow(input.now);
|
|
3095
|
+
var correctnessChecks = asArray(input.correctnessChecks);
|
|
3096
|
+
var failedChecks = assistantCorrectnessFailed(correctnessChecks);
|
|
3097
|
+
var queryStatus = assistantQueryStatus(quality.queryStatus || quality.query_status || quality.queryResult || quality.query_result);
|
|
3098
|
+
var confidenceLevel = assistantConfidenceLevel(quality.confidence || quality.confidenceLevel || quality.confidence_level);
|
|
3099
|
+
var evidenceRefs = assistantEvidenceRefs(quality);
|
|
3100
|
+
var citationRefs = assistantCitationRefs(quality);
|
|
3101
|
+
var queryExecutions = assistantQueryExecutions(quality);
|
|
3102
|
+
var queryEvidenceRefs = assistantQueryEvidenceRefs(quality, queryExecutions);
|
|
3103
|
+
var nextActions = assistantNextActions(quality);
|
|
3104
|
+
var requiresCurrentDate = quality.requiresCurrentDate === true || quality.requires_current_date === true;
|
|
3105
|
+
var dateWindowRequired = quality.requiresDateWindow === true
|
|
3106
|
+
|| quality.requires_date_window === true
|
|
3107
|
+
|| quality.dateWindowRequired === true
|
|
3108
|
+
|| quality.date_window_required === true;
|
|
3109
|
+
var requiresCitations = quality.requiresCitations !== false && quality.requires_citations !== false;
|
|
3110
|
+
var requiresNextAction = quality.requiresNextAction !== false && quality.requires_next_action !== false;
|
|
3111
|
+
var dateWindow = assistantDateWindowObject(quality);
|
|
3112
|
+
var dateWindowStart = cleanText(dateWindow.startDate || dateWindow.start_date || dateWindow.start, 80);
|
|
3113
|
+
var dateWindowEnd = cleanText(dateWindow.endDate || dateWindow.end_date || dateWindow.end, 80);
|
|
3114
|
+
var dateWindowPresent = !!dateWindowStart && !!dateWindowEnd;
|
|
3115
|
+
var dateBasis = cleanText(quality.currentDateUsed
|
|
3116
|
+
|| quality.current_date_used
|
|
3117
|
+
|| quality.dateBasis
|
|
3118
|
+
|| quality.date_basis
|
|
3119
|
+
|| ((_a = quality.dateWindow) === null || _a === void 0 ? void 0 : _a.basisDate)
|
|
3120
|
+
|| ((_b = quality.date_window) === null || _b === void 0 ? void 0 : _b.basis_date), 80);
|
|
3121
|
+
var expectedCurrentDate = cleanText(quality.expectedCurrentDate || quality.expected_current_date, 80)
|
|
3122
|
+
|| normalizedIsoDay(input.now);
|
|
3123
|
+
var noDataConfirmed = quality.noDataConfirmed === true
|
|
3124
|
+
|| quality.no_data_confirmed === true
|
|
3125
|
+
|| quality.confirmedNoData === true
|
|
3126
|
+
|| quality.confirmed_no_data === true;
|
|
3127
|
+
var legalQueryShape = assistantQueryShapeLegal(quality);
|
|
3128
|
+
var queryEvidenceRequired = quality.requiresQueryEvidence !== false
|
|
3129
|
+
&& quality.requires_query_evidence !== false
|
|
3130
|
+
&& (queryStatus === 'ok' || queryStatus === 'no_data');
|
|
3131
|
+
var queryEvidencePresent = queryExecutions.length > 0 || queryEvidenceRefs.length > 0;
|
|
3132
|
+
var blockers = [];
|
|
3133
|
+
var status = 'ready';
|
|
3134
|
+
var reason = 'Assistant answer has structured data evidence, legal query shape, citations, confidence, and next action.';
|
|
3135
|
+
if (!Object.keys(quality).length) {
|
|
3136
|
+
status = 'missing_data_source';
|
|
3137
|
+
blockers.push('Assistant answerQuality evidence is missing.');
|
|
3138
|
+
reason = 'Assistant answer cannot be accepted without structured answerQuality evidence.';
|
|
3139
|
+
}
|
|
3140
|
+
else if (failedChecks.length) {
|
|
3141
|
+
status = 'incorrect';
|
|
3142
|
+
blockers.push.apply(blockers, __spreadArray([], __read(failedChecks), false));
|
|
3143
|
+
reason = 'Assistant correctness checks failed.';
|
|
3144
|
+
}
|
|
3145
|
+
else if (queryStatus === 'permission_error') {
|
|
3146
|
+
status = 'permission_error';
|
|
3147
|
+
blockers.push('Assistant data query was blocked by permission or authorization.');
|
|
3148
|
+
reason = 'Assistant must report permission-error state and avoid claiming no data or success.';
|
|
3149
|
+
}
|
|
3150
|
+
else if (queryStatus === 'query_error') {
|
|
3151
|
+
status = 'query_error';
|
|
3152
|
+
blockers.push('Assistant data query failed.');
|
|
3153
|
+
reason = 'Assistant must report query-error state and avoid claiming no data or success.';
|
|
3154
|
+
}
|
|
3155
|
+
else if (!legalQueryShape) {
|
|
3156
|
+
status = 'illegal_query_shape';
|
|
3157
|
+
blockers.push('Assistant query shape is illegal or uses an unsafe Mongo projection shape.');
|
|
3158
|
+
reason = 'Assistant must use legal Mongo query/projection shapes before answering.';
|
|
3159
|
+
}
|
|
3160
|
+
else if (requiresCurrentDate && (!dateBasis || normalizedIsoDay(dateBasis) !== normalizedIsoDay(expectedCurrentDate))) {
|
|
3161
|
+
status = 'date_incorrect';
|
|
3162
|
+
blockers.push("Expected current date ".concat(normalizedIsoDay(expectedCurrentDate) || expectedCurrentDate, ", got ").concat(dateBasis || 'missing date basis', "."));
|
|
3163
|
+
reason = 'Assistant answer did not prove it used the actual current date.';
|
|
3164
|
+
}
|
|
3165
|
+
else if (dateWindowRequired && !dateWindowPresent) {
|
|
3166
|
+
status = 'missing_date_window';
|
|
3167
|
+
blockers.push('Assistant dated answer did not record concrete date-window start and end evidence.');
|
|
3168
|
+
reason = 'Assistant dated answers must record the exact query date window used.';
|
|
3169
|
+
}
|
|
3170
|
+
else if (queryStatus === 'unknown') {
|
|
3171
|
+
status = 'missing_data_source';
|
|
3172
|
+
blockers.push('Assistant answer did not record queryStatus ok/no_data/query_error/permission_error.');
|
|
3173
|
+
reason = 'Assistant answer must classify data access result before acceptance.';
|
|
3174
|
+
}
|
|
3175
|
+
else if (queryStatus === 'no_data' && !noDataConfirmed) {
|
|
3176
|
+
status = 'no_data_unverified';
|
|
3177
|
+
blockers.push('No-data answer was not confirmed by a probe or query evidence.');
|
|
3178
|
+
reason = 'Assistant no-data answers require explicit noDataConfirmed evidence.';
|
|
3179
|
+
}
|
|
3180
|
+
else if (queryEvidenceRequired && !queryEvidencePresent) {
|
|
3181
|
+
status = 'missing_query_proof';
|
|
3182
|
+
blockers.push('Assistant data answer did not record a structured query execution, tool result, or query evidence reference.');
|
|
3183
|
+
reason = 'Assistant answers from system data require structured query/tool execution proof before acceptance.';
|
|
3184
|
+
}
|
|
3185
|
+
else if (requiresCitations && !citationRefs.length && !evidenceRefs.length) {
|
|
3186
|
+
status = 'missing_citations';
|
|
3187
|
+
blockers.push('Assistant answer has no cited evidence or artifact reference.');
|
|
3188
|
+
reason = 'Assistant answer must cite system data evidence.';
|
|
3189
|
+
}
|
|
3190
|
+
else if (confidenceLevel === 'low' || confidenceLevel === 'unknown') {
|
|
3191
|
+
status = 'low_confidence';
|
|
3192
|
+
blockers.push('Assistant answer confidence is low or unknown.');
|
|
3193
|
+
reason = 'Assistant answer requires recorded medium/high confidence.';
|
|
3194
|
+
}
|
|
3195
|
+
else if (requiresNextAction && !nextActions.length) {
|
|
3196
|
+
status = 'missing_next_action';
|
|
3197
|
+
blockers.push('Assistant answer did not record next actions.');
|
|
3198
|
+
reason = 'Assistant answer must provide a next action or explicit no-action state.';
|
|
3199
|
+
}
|
|
3200
|
+
return {
|
|
3201
|
+
ready: status === 'ready',
|
|
3202
|
+
status: status,
|
|
3203
|
+
reason: reason,
|
|
3204
|
+
blockers: blockers,
|
|
3205
|
+
queryStatus: queryStatus,
|
|
3206
|
+
confidenceLevel: confidenceLevel,
|
|
3207
|
+
dateBasis: dateBasis || undefined,
|
|
3208
|
+
expectedCurrentDate: expectedCurrentDate || undefined,
|
|
3209
|
+
dateWindowRequired: dateWindowRequired,
|
|
3210
|
+
dateWindowPresent: dateWindowPresent,
|
|
3211
|
+
dateWindow: dateWindowPresent ? {
|
|
3212
|
+
startDate: dateWindowStart,
|
|
3213
|
+
endDate: dateWindowEnd,
|
|
3214
|
+
mode: cleanText(dateWindow.mode || dateWindow.type, 80) || undefined,
|
|
3215
|
+
months: typeof dateWindow.months === 'number' ? dateWindow.months : undefined
|
|
3216
|
+
} : undefined,
|
|
3217
|
+
noDataConfirmed: noDataConfirmed,
|
|
3218
|
+
legalQueryShape: legalQueryShape,
|
|
3219
|
+
citationRefs: citationRefs,
|
|
3220
|
+
queryEvidenceRequired: queryEvidenceRequired,
|
|
3221
|
+
queryEvidencePresent: queryEvidencePresent,
|
|
3222
|
+
queryEvidenceRefs: queryEvidenceRefs,
|
|
3223
|
+
queryExecutionCount: queryExecutions.length,
|
|
3224
|
+
nextActions: nextActions,
|
|
3225
|
+
evidenceRefs: evidenceRefs,
|
|
3226
|
+
failedChecks: failedChecks,
|
|
3227
|
+
recordedAt: now
|
|
3228
|
+
};
|
|
3229
|
+
}
|
|
3230
|
+
function assistantAnswerQualityGate(decision, now) {
|
|
3231
|
+
var status = decision.ready
|
|
3232
|
+
? 'pass'
|
|
3233
|
+
: /incorrect|date_incorrect|missing_date_window|illegal_query_shape/.test(decision.status)
|
|
3234
|
+
? 'fail'
|
|
3235
|
+
: 'blocked';
|
|
3236
|
+
return {
|
|
3237
|
+
key: 'assistant_answer_quality',
|
|
3238
|
+
label: 'Assistant answer quality',
|
|
3239
|
+
status: status,
|
|
3240
|
+
reason: decision.reason,
|
|
3241
|
+
evidenceRefs: decision.evidenceRefs.length ? decision.evidenceRefs : decision.citationRefs,
|
|
3242
|
+
recordedAt: isoNow(now || decision.recordedAt),
|
|
3243
|
+
metadata: {
|
|
3244
|
+
ready: decision.ready,
|
|
3245
|
+
status: decision.status,
|
|
3246
|
+
queryStatus: decision.queryStatus,
|
|
3247
|
+
confidenceLevel: decision.confidenceLevel,
|
|
3248
|
+
dateBasis: decision.dateBasis,
|
|
3249
|
+
expectedCurrentDate: decision.expectedCurrentDate,
|
|
3250
|
+
dateWindowRequired: decision.dateWindowRequired,
|
|
3251
|
+
dateWindowPresent: decision.dateWindowPresent,
|
|
3252
|
+
dateWindow: decision.dateWindow,
|
|
3253
|
+
noDataConfirmed: decision.noDataConfirmed,
|
|
3254
|
+
legalQueryShape: decision.legalQueryShape,
|
|
3255
|
+
citationRefs: decision.citationRefs,
|
|
3256
|
+
queryEvidenceRequired: decision.queryEvidenceRequired,
|
|
3257
|
+
queryEvidencePresent: decision.queryEvidencePresent,
|
|
3258
|
+
queryEvidenceRefs: decision.queryEvidenceRefs,
|
|
3259
|
+
queryExecutionCount: decision.queryExecutionCount,
|
|
3260
|
+
nextActions: decision.nextActions,
|
|
3261
|
+
blockers: decision.blockers,
|
|
3262
|
+
failedChecks: decision.failedChecks
|
|
3263
|
+
}
|
|
3264
|
+
};
|
|
3265
|
+
}
|
|
3266
|
+
function assistantActionabilityStatus(decision) {
|
|
3267
|
+
switch (decision.status) {
|
|
3268
|
+
case 'ready':
|
|
3269
|
+
return 'ready_to_answer';
|
|
3270
|
+
case 'query_error':
|
|
3271
|
+
return 'needs_query_repair';
|
|
3272
|
+
case 'permission_error':
|
|
3273
|
+
return 'needs_permission';
|
|
3274
|
+
case 'no_data_unverified':
|
|
3275
|
+
return 'needs_no_data_verification';
|
|
3276
|
+
case 'date_incorrect':
|
|
3277
|
+
case 'missing_date_window':
|
|
3278
|
+
return 'needs_date_window_repair';
|
|
3279
|
+
case 'illegal_query_shape':
|
|
3280
|
+
return 'needs_query_shape_repair';
|
|
3281
|
+
case 'missing_data_source':
|
|
3282
|
+
case 'missing_query_proof':
|
|
3283
|
+
case 'missing_citations':
|
|
3284
|
+
return 'needs_evidence';
|
|
3285
|
+
case 'low_confidence':
|
|
3286
|
+
return 'needs_confidence_review';
|
|
3287
|
+
case 'missing_next_action':
|
|
3288
|
+
return 'needs_next_action';
|
|
3289
|
+
case 'incorrect':
|
|
3290
|
+
return 'incorrect';
|
|
3291
|
+
default:
|
|
3292
|
+
return 'blocked';
|
|
3293
|
+
}
|
|
3294
|
+
}
|
|
3295
|
+
function assistantActionabilityCommand(status) {
|
|
3296
|
+
switch (status) {
|
|
3297
|
+
case 'ready_to_answer':
|
|
3298
|
+
return 'answer_from_verified_system_data';
|
|
3299
|
+
case 'needs_query_repair':
|
|
3300
|
+
return 'repair_assistant_query_and_rerun';
|
|
3301
|
+
case 'needs_permission':
|
|
3302
|
+
return 'request_assistant_data_permission';
|
|
3303
|
+
case 'needs_no_data_verification':
|
|
3304
|
+
return 'verify_no_data_with_scoped_probe';
|
|
3305
|
+
case 'needs_date_window_repair':
|
|
3306
|
+
return 'repair_assistant_date_window_and_rerun';
|
|
3307
|
+
case 'needs_query_shape_repair':
|
|
3308
|
+
return 'repair_assistant_mongo_query_shape';
|
|
3309
|
+
case 'needs_confidence_review':
|
|
3310
|
+
return 'review_assistant_confidence_evidence';
|
|
3311
|
+
case 'needs_next_action':
|
|
3312
|
+
return 'add_assistant_next_action';
|
|
3313
|
+
case 'incorrect':
|
|
3314
|
+
return 'repair_assistant_answer_from_failed_check';
|
|
3315
|
+
case 'needs_evidence':
|
|
3316
|
+
case 'blocked':
|
|
3317
|
+
default:
|
|
3318
|
+
return 'collect_assistant_answer_evidence';
|
|
3319
|
+
}
|
|
3320
|
+
}
|
|
3321
|
+
function assistantActionabilityLabel(status) {
|
|
3322
|
+
switch (status) {
|
|
3323
|
+
case 'ready_to_answer':
|
|
3324
|
+
return 'Answer From Verified Data';
|
|
3325
|
+
case 'needs_query_repair':
|
|
3326
|
+
return 'Repair Query';
|
|
3327
|
+
case 'needs_permission':
|
|
3328
|
+
return 'Request Data Permission';
|
|
3329
|
+
case 'needs_no_data_verification':
|
|
3330
|
+
return 'Verify No Data';
|
|
3331
|
+
case 'needs_date_window_repair':
|
|
3332
|
+
return 'Repair Date Window';
|
|
3333
|
+
case 'needs_query_shape_repair':
|
|
3334
|
+
return 'Repair Query Shape';
|
|
3335
|
+
case 'needs_confidence_review':
|
|
3336
|
+
return 'Review Confidence';
|
|
3337
|
+
case 'needs_next_action':
|
|
3338
|
+
return 'Add Next Action';
|
|
3339
|
+
case 'incorrect':
|
|
3340
|
+
return 'Repair Incorrect Answer';
|
|
3341
|
+
default:
|
|
3342
|
+
return 'Collect Answer Evidence';
|
|
3343
|
+
}
|
|
3344
|
+
}
|
|
3345
|
+
function buildAssistantAnswerActionabilityContract(decision, now) {
|
|
3346
|
+
var status = assistantActionabilityStatus(decision);
|
|
3347
|
+
var primaryCommand = assistantActionabilityCommand(status);
|
|
3348
|
+
var ready = status === 'ready_to_answer';
|
|
3349
|
+
var noDataReady = ready && decision.queryStatus === 'no_data' && decision.noDataConfirmed;
|
|
3350
|
+
var canAnswerCustomer = ready && (decision.queryStatus === 'ok'
|
|
3351
|
+
|| noDataReady
|
|
3352
|
+
|| decision.queryEvidenceRequired === false);
|
|
3353
|
+
var canDraftSupportReply = canAnswerCustomer && decision.confidenceLevel === 'high';
|
|
3354
|
+
var requiresHumanReview = !canAnswerCustomer || canDraftSupportReply;
|
|
3355
|
+
var cheapRepair = /needs_(?:no_data|date_window|query_shape|next_action)|needs_evidence/.test(status);
|
|
3356
|
+
var blockers = decision.blockers.length
|
|
3357
|
+
? decision.blockers
|
|
3358
|
+
: (ready ? [] : [decision.reason]);
|
|
3359
|
+
var requiredEvidence = Array.from(new Set(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((decision.queryEvidenceRequired ? ['structured query/tool execution proof'] : [])), false), __read((decision.dateWindowRequired ? ['concrete date-window start and end'] : [])), false), __read((decision.queryStatus === 'no_data' ? ['noDataConfirmed=true from scoped probe or query evidence'] : [])), false), __read((decision.legalQueryShape ? [] : ['legal Mongo query/projection shape'])), false), __read((decision.citationRefs.length || decision.evidenceRefs.length ? [] : ['citationRefs or evidenceRefs'])), false), __read((decision.nextActions.length ? [] : ['one explicit next action or no-action state'])), false), __read((decision.confidenceLevel === 'low' || decision.confidenceLevel === 'unknown' ? ['medium/high confidence evidence'] : [])), false))).slice(0, 20);
|
|
3360
|
+
return {
|
|
3361
|
+
contractId: "assistant-actionability:".concat(decision.status, ":").concat(decision.queryStatus, ":").concat(decision.recordedAt),
|
|
3362
|
+
status: status,
|
|
3363
|
+
primaryCommand: primaryCommand,
|
|
3364
|
+
label: assistantActionabilityLabel(status),
|
|
3365
|
+
canAnswerCustomer: canAnswerCustomer,
|
|
3366
|
+
canDraftSupportReply: canDraftSupportReply,
|
|
3367
|
+
canSendCustomerReply: false,
|
|
3368
|
+
requiresHumanReview: requiresHumanReview,
|
|
3369
|
+
canRunWithoutCodexMonitor: ready || cheapRepair,
|
|
3370
|
+
codexFallbackRequired: !ready && !cheapRepair,
|
|
3371
|
+
costRisk: ready
|
|
3372
|
+
? 'free_or_deterministic'
|
|
3373
|
+
: status === 'needs_permission'
|
|
3374
|
+
? 'manual_blocked'
|
|
3375
|
+
: (status === 'needs_query_repair' || status === 'incorrect' ? 'small_model_or_qa' : 'free_or_deterministic'),
|
|
3376
|
+
queryResultClass: decision.queryStatus,
|
|
3377
|
+
confidenceLevel: decision.confidenceLevel,
|
|
3378
|
+
decisionBasis: {
|
|
3379
|
+
answerQualityStatus: decision.status,
|
|
3380
|
+
queryStatus: decision.queryStatus,
|
|
3381
|
+
queryEvidencePresent: decision.queryEvidencePresent,
|
|
3382
|
+
noDataConfirmed: decision.noDataConfirmed,
|
|
3383
|
+
legalQueryShape: decision.legalQueryShape,
|
|
3384
|
+
dateWindowRequired: decision.dateWindowRequired,
|
|
3385
|
+
dateWindowPresent: decision.dateWindowPresent,
|
|
3386
|
+
citationCount: decision.citationRefs.length + decision.evidenceRefs.length,
|
|
3387
|
+
nextActionCount: decision.nextActions.length
|
|
3388
|
+
},
|
|
3389
|
+
requiredEvidence: requiredEvidence,
|
|
3390
|
+
successEvidence: Array.from(new Set(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((ready ? ['assistant answer quality gate passed'] : [])), false), __read((decision.queryEvidenceRefs.length ? decision.queryEvidenceRefs : [])), false), __read((decision.citationRefs.length ? decision.citationRefs : [])), false), __read((decision.evidenceRefs.length ? decision.evidenceRefs : [])), false))).slice(0, 20),
|
|
3391
|
+
blockers: blockers,
|
|
3392
|
+
nextActions: decision.nextActions,
|
|
3393
|
+
nextCommands: Array.from(new Set(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([
|
|
3394
|
+
primaryCommand
|
|
3395
|
+
], __read((status === 'needs_query_repair' ? ['fix_query_error', 'rerun_assistant_query'] : [])), false), __read((status === 'needs_no_data_verification' ? ['run_tiny_shape_probe', 'record_no_data_confirmed'] : [])), false), __read((status === 'needs_date_window_repair' ? ['resolve_current_date', 'record_concrete_date_window', 'rerun_assistant_query'] : [])), false), __read((status === 'needs_query_shape_repair' ? ['rewrite_illegal_projection', 'rerun_query_shape_validator'] : [])), false), __read((status === 'needs_permission' ? ['request_permission_or_choose_allowed_route'] : [])), false), [
|
|
3396
|
+
'record_assistant_actionability_result'
|
|
3397
|
+
], false))).slice(0, 20),
|
|
3398
|
+
forbiddenActions: Array.from(new Set(__spreadArray(__spreadArray(__spreadArray(__spreadArray([
|
|
3399
|
+
'Do not answer from keyword or route guesses without verified query evidence.',
|
|
3400
|
+
'Do not claim no data when queryStatus is query_error or permission_error.'
|
|
3401
|
+
], __read((decision.queryStatus === 'no_data' && !decision.noDataConfirmed ? ['Do not present no-data answer until noDataConfirmed=true.'] : [])), false), __read((decision.legalQueryShape ? [] : ['Do not answer from illegal Mongo projection/query shape.'])), false), __read((decision.dateWindowRequired && !decision.dateWindowPresent ? ['Do not answer dated questions without concrete start/end date evidence.'] : [])), false), __read((decision.confidenceLevel === 'low' || decision.confidenceLevel === 'unknown' ? ['Do not draft support/customer reply from low or unknown confidence.'] : [])), false))).slice(0, 20),
|
|
3402
|
+
evidenceRefs: Array.from(new Set(__spreadArray(__spreadArray(__spreadArray([], __read(decision.queryEvidenceRefs), false), __read(decision.citationRefs), false), __read(decision.evidenceRefs), false))).slice(0, 40),
|
|
3403
|
+
recordedAt: isoNow(now || decision.recordedAt)
|
|
3404
|
+
};
|
|
3405
|
+
}
|
|
3406
|
+
function assistantAnswerActionabilityGate(contract, now) {
|
|
3407
|
+
var status = contract.status === 'ready_to_answer'
|
|
3408
|
+
? 'pass'
|
|
3409
|
+
: contract.status === 'incorrect' || contract.status === 'needs_query_shape_repair' || contract.status === 'needs_date_window_repair'
|
|
3410
|
+
? 'fail'
|
|
3411
|
+
: 'blocked';
|
|
3412
|
+
return {
|
|
3413
|
+
key: 'assistant_answer_actionability',
|
|
3414
|
+
label: 'Assistant answer actionability',
|
|
3415
|
+
status: status,
|
|
3416
|
+
reason: status === 'pass'
|
|
3417
|
+
? 'Assistant answer can proceed from verified structured evidence.'
|
|
3418
|
+
: (contract.blockers.join(' ') || 'Assistant answer is blocked until actionability evidence is complete.'),
|
|
3419
|
+
evidenceRefs: contract.evidenceRefs,
|
|
3420
|
+
recordedAt: isoNow(now || contract.recordedAt),
|
|
3421
|
+
metadata: {
|
|
3422
|
+
contractId: contract.contractId,
|
|
3423
|
+
status: contract.status,
|
|
3424
|
+
primaryCommand: contract.primaryCommand,
|
|
3425
|
+
label: contract.label,
|
|
3426
|
+
canAnswerCustomer: contract.canAnswerCustomer,
|
|
3427
|
+
canDraftSupportReply: contract.canDraftSupportReply,
|
|
3428
|
+
canSendCustomerReply: contract.canSendCustomerReply,
|
|
3429
|
+
requiresHumanReview: contract.requiresHumanReview,
|
|
3430
|
+
canRunWithoutCodexMonitor: contract.canRunWithoutCodexMonitor,
|
|
3431
|
+
codexFallbackRequired: contract.codexFallbackRequired,
|
|
3432
|
+
costRisk: contract.costRisk,
|
|
3433
|
+
queryResultClass: contract.queryResultClass,
|
|
3434
|
+
confidenceLevel: contract.confidenceLevel,
|
|
3435
|
+
decisionBasis: contract.decisionBasis,
|
|
3436
|
+
requiredEvidence: contract.requiredEvidence,
|
|
3437
|
+
successEvidence: contract.successEvidence,
|
|
3438
|
+
blockers: contract.blockers,
|
|
3439
|
+
nextActions: contract.nextActions,
|
|
3440
|
+
nextCommands: contract.nextCommands,
|
|
3441
|
+
forbiddenActions: contract.forbiddenActions
|
|
3442
|
+
}
|
|
3443
|
+
};
|
|
3444
|
+
}
|
|
3445
|
+
function applyAssistantAnswerQualityGate(qa, decision, now) {
|
|
3446
|
+
var gate = assistantAnswerQualityGate(decision, now);
|
|
3447
|
+
if (decision.ready) {
|
|
3448
|
+
return __assign(__assign({}, qa), { gateResults: __spreadArray(__spreadArray([], __read(qa.gateResults), false), [gate], false) });
|
|
3449
|
+
}
|
|
3450
|
+
return __assign(__assign({}, qa), { outcome: /incorrect|date_incorrect|missing_date_window|illegal_query_shape/.test(decision.status)
|
|
3451
|
+
? 'business_assertion_failed'
|
|
3452
|
+
: 'incomplete', gateResults: __spreadArray(__spreadArray([], __read(qa.gateResults.filter(function (existing) { return !(existing.key === 'qa_business_assertion' && existing.status === 'pass'); })), false), [
|
|
3453
|
+
gate
|
|
3454
|
+
], false) });
|
|
3455
|
+
}
|
|
3456
|
+
function buildSupportAIRunFromEvidence(input) {
|
|
3457
|
+
var e_32, _a, e_33, _b;
|
|
3458
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, _70, _71, _72, _73, _74, _75, _76, _77, _78, _79, _80, _81, _82, _83, _84, _85, _86, _87, _88, _89, _90;
|
|
3459
|
+
var ticket = input.ticket || {};
|
|
3460
|
+
var job = input.job || {};
|
|
3461
|
+
var evidence = buildSupportQaEvidence(input);
|
|
3462
|
+
var events = [];
|
|
3463
|
+
var gates = [];
|
|
3464
|
+
var sourceIds = {};
|
|
3465
|
+
addSourceId(sourceIds, 'ticketId', ticket._id || ticket.id || job.ticketId || job.supportTicketId);
|
|
3466
|
+
addSourceId(sourceIds, 'ticketNumber', ticket.ticketNumber || ticket.number || job.ticketNumber);
|
|
3467
|
+
addSourceId(sourceIds, 'jobId', job._id || job.id || job.jobId);
|
|
3468
|
+
addSourceId(sourceIds, 'buildPlanId', job.buildPlanId || ticket.buildPlanId);
|
|
3469
|
+
try {
|
|
3470
|
+
for (var _91 = __values(asArray(input.taskEvents)), _92 = _91.next(); !_92.done; _92 = _91.next()) {
|
|
3471
|
+
var event_1 = _92.value;
|
|
3472
|
+
pushEvent(events, {
|
|
3473
|
+
type: event_1.type === 'human_intervention' ? 'human_intervention' : 'log',
|
|
3474
|
+
category: cleanText(event_1.category || event_1.phase || event_1.type, 160),
|
|
3475
|
+
message: cleanText(event_1.message || event_1.summary || event_1.text || event_1.title, 1800),
|
|
3476
|
+
recordedAt: eventDate(event_1),
|
|
3477
|
+
metadata: {
|
|
3478
|
+
status: event_1.status,
|
|
3479
|
+
phase: event_1.phase,
|
|
3480
|
+
taskId: event_1.taskId || event_1._id || event_1.id
|
|
3481
|
+
}
|
|
3482
|
+
});
|
|
3483
|
+
}
|
|
3484
|
+
}
|
|
3485
|
+
catch (e_32_1) { e_32 = { error: e_32_1 }; }
|
|
3486
|
+
finally {
|
|
3487
|
+
try {
|
|
3488
|
+
if (_92 && !_92.done && (_a = _91.return)) _a.call(_91);
|
|
3489
|
+
}
|
|
3490
|
+
finally { if (e_32) throw e_32.error; }
|
|
3491
|
+
}
|
|
3492
|
+
try {
|
|
3493
|
+
for (var _93 = __values(asArray(input.aiJobs)), _94 = _93.next(); !_94.done; _94 = _93.next()) {
|
|
3494
|
+
var aiJob = _94.value;
|
|
3495
|
+
pushEvent(events, {
|
|
3496
|
+
type: aiJob.model ? 'model_call' : 'log',
|
|
3497
|
+
category: cleanText(aiJob.category || aiJob.phase || aiJob.runner, 160),
|
|
3498
|
+
message: cleanText(aiJob.summary || aiJob.promptSummary || aiJob.status || aiJob.phase, 1800),
|
|
3499
|
+
recordedAt: eventDate(aiJob),
|
|
3500
|
+
metadata: {
|
|
3501
|
+
id: aiJob._id || aiJob.id,
|
|
3502
|
+
model: aiJob.model,
|
|
3503
|
+
status: aiJob.status,
|
|
3504
|
+
phase: aiJob.phase
|
|
3505
|
+
}
|
|
3506
|
+
});
|
|
3507
|
+
}
|
|
3508
|
+
}
|
|
3509
|
+
catch (e_33_1) { e_33 = { error: e_33_1 }; }
|
|
3510
|
+
finally {
|
|
3511
|
+
try {
|
|
3512
|
+
if (_94 && !_94.done && (_b = _93.return)) _b.call(_93);
|
|
3513
|
+
}
|
|
3514
|
+
finally { if (e_33) throw e_33.error; }
|
|
3515
|
+
}
|
|
3516
|
+
collectCommitEvents(asArray(input.commits), events);
|
|
3517
|
+
collectHotfixEvidenceEvents([job, ticket, evidence, input.qaEvidence], events, gates, input.now);
|
|
3518
|
+
var noBlindLoopGate = supportManagerNoBlindLoopGate(job, evidence, input.now);
|
|
3519
|
+
if (noBlindLoopGate) {
|
|
3520
|
+
gates.push(noBlindLoopGate);
|
|
3521
|
+
pushEvent(events, {
|
|
3522
|
+
type: 'log',
|
|
3523
|
+
category: 'manager_no_blind_loop_policy',
|
|
3524
|
+
message: noBlindLoopGate.reason,
|
|
3525
|
+
artifactPaths: noBlindLoopGate.evidenceRefs,
|
|
3526
|
+
recordedAt: noBlindLoopGate.recordedAt,
|
|
3527
|
+
metadata: noBlindLoopGate.metadata
|
|
3528
|
+
});
|
|
3529
|
+
}
|
|
3530
|
+
var businessProofReadiness = plainObject(evidence.businessProofReadiness || evidence.business_proof_readiness);
|
|
3531
|
+
var businessProofReadinessGate = supportBusinessProofReadinessGate(businessProofReadiness, input.now);
|
|
3532
|
+
if (businessProofReadinessGate) {
|
|
3533
|
+
gates.push(businessProofReadinessGate);
|
|
3534
|
+
pushEvent(events, {
|
|
3535
|
+
type: 'qa_business_assertion',
|
|
3536
|
+
category: 'support_business_proof_readiness',
|
|
3537
|
+
message: businessProofReadinessGate.reason,
|
|
3538
|
+
artifactPaths: businessProofReadinessGate.evidenceRefs,
|
|
3539
|
+
recordedAt: businessProofReadinessGate.recordedAt,
|
|
3540
|
+
metadata: businessProofReadinessGate.metadata
|
|
3541
|
+
});
|
|
3542
|
+
}
|
|
3543
|
+
var customerReplyPolicy = plainObject(evidence.customerReplyPolicy || evidence.customer_reply_policy);
|
|
3544
|
+
var customerReplyPolicyGate = supportCustomerReplyPolicyGate(customerReplyPolicy, input.now);
|
|
3545
|
+
if (customerReplyPolicyGate) {
|
|
3546
|
+
gates.push(customerReplyPolicyGate);
|
|
3547
|
+
pushEvent(events, {
|
|
3548
|
+
type: 'human_intervention',
|
|
3549
|
+
category: 'support_customer_reply_policy',
|
|
3550
|
+
message: customerReplyPolicyGate.reason,
|
|
3551
|
+
artifactPaths: customerReplyPolicyGate.evidenceRefs,
|
|
3552
|
+
recordedAt: customerReplyPolicyGate.recordedAt,
|
|
3553
|
+
metadata: customerReplyPolicyGate.metadata
|
|
3554
|
+
});
|
|
3555
|
+
}
|
|
3556
|
+
var customerReplyReadiness = plainObject(evidence.customerReplyReadiness
|
|
3557
|
+
|| evidence.customer_reply_readiness
|
|
3558
|
+
|| customerReplyPolicy.readinessContract
|
|
3559
|
+
|| customerReplyPolicy.readiness_contract);
|
|
3560
|
+
var customerReplyReadinessGate = supportCustomerReplyReadinessGate(customerReplyReadiness, input.now);
|
|
3561
|
+
if (customerReplyReadinessGate) {
|
|
3562
|
+
gates.push(customerReplyReadinessGate);
|
|
3563
|
+
pushEvent(events, {
|
|
3564
|
+
type: 'human_intervention',
|
|
3565
|
+
category: 'support_customer_reply_readiness',
|
|
3566
|
+
message: customerReplyReadinessGate.reason,
|
|
3567
|
+
artifactPaths: customerReplyReadinessGate.evidenceRefs,
|
|
3568
|
+
recordedAt: customerReplyReadinessGate.recordedAt,
|
|
3569
|
+
metadata: customerReplyReadinessGate.metadata
|
|
3570
|
+
});
|
|
3571
|
+
}
|
|
3572
|
+
var nextActionContract = supportNextActionContractObject(ticket, job, evidence);
|
|
3573
|
+
var nextActionContractRequired = supportNextActionContractRequired(ticket, job, evidence);
|
|
3574
|
+
var nextActionContractGate = supportNextActionContractGate(nextActionContract, input.now, nextActionContractRequired);
|
|
3575
|
+
if (nextActionContractGate) {
|
|
3576
|
+
gates.push(nextActionContractGate);
|
|
3577
|
+
pushEvent(events, {
|
|
3578
|
+
type: 'log',
|
|
3579
|
+
category: 'support_next_action_contract',
|
|
3580
|
+
message: nextActionContractGate.reason,
|
|
3581
|
+
artifactPaths: nextActionContractGate.evidenceRefs,
|
|
3582
|
+
recordedAt: nextActionContractGate.recordedAt,
|
|
3583
|
+
metadata: nextActionContractGate.metadata
|
|
3584
|
+
});
|
|
3585
|
+
}
|
|
3586
|
+
var managerExecutionPacket = supportManagerExecutionPacketObject(ticket, job, evidence, nextActionContract);
|
|
3587
|
+
var managerExecutionPacketGate = supportManagerExecutionPacketGate(managerExecutionPacket, input.now, nextActionContractRequired);
|
|
3588
|
+
if (managerExecutionPacketGate) {
|
|
3589
|
+
gates.push(managerExecutionPacketGate);
|
|
3590
|
+
pushEvent(events, {
|
|
3591
|
+
type: 'log',
|
|
3592
|
+
category: 'support_manager_execution_packet',
|
|
3593
|
+
message: managerExecutionPacketGate.reason,
|
|
3594
|
+
artifactPaths: managerExecutionPacketGate.evidenceRefs,
|
|
3595
|
+
recordedAt: managerExecutionPacketGate.recordedAt,
|
|
3596
|
+
metadata: managerExecutionPacketGate.metadata
|
|
3597
|
+
});
|
|
3598
|
+
}
|
|
3599
|
+
var managerRecoveryExecutionProof = plainObject(evidence.managerRecoveryExecutionProof || evidence.manager_recovery_execution_proof);
|
|
3600
|
+
var recoveryExecutionProofGate = managerRecoveryExecutionProofGate(managerRecoveryExecutionProof, input.now);
|
|
3601
|
+
if (recoveryExecutionProofGate) {
|
|
3602
|
+
gates.push(recoveryExecutionProofGate);
|
|
3603
|
+
pushEvent(events, {
|
|
3604
|
+
type: 'log',
|
|
3605
|
+
category: 'manager_recovery_execution_proof',
|
|
3606
|
+
message: recoveryExecutionProofGate.reason,
|
|
3607
|
+
artifactPaths: recoveryExecutionProofGate.evidenceRefs,
|
|
3608
|
+
recordedAt: recoveryExecutionProofGate.recordedAt,
|
|
3609
|
+
metadata: recoveryExecutionProofGate.metadata
|
|
3610
|
+
});
|
|
3611
|
+
}
|
|
3612
|
+
var ticketAutomation = plainObject(ticket.automation);
|
|
3613
|
+
var ticketManagerState = plainObject(ticketAutomation.manager || ticket.manager);
|
|
3614
|
+
var rootCauseEntryContract = evidenceObject(job.supportRootCauseEntryContract, job.support_root_cause_entry_contract, job.rootCauseEntryContract, ticket.supportRootCauseEntryContract, ticket.rootCauseEntryContract, ticketManagerState.root_cause_entry_contract, ticketManagerState.rootCauseEntryContract, evidence.rootCauseEntryContract, evidence.root_cause_entry_contract);
|
|
3615
|
+
var rootCauseEntryContractGate = supportRootCauseEntryContractGate(rootCauseEntryContract, input.now);
|
|
3616
|
+
if (rootCauseEntryContractGate) {
|
|
3617
|
+
gates.push(rootCauseEntryContractGate);
|
|
3618
|
+
pushEvent(events, {
|
|
3619
|
+
type: 'log',
|
|
3620
|
+
category: 'support_root_cause_entry_contract',
|
|
3621
|
+
message: rootCauseEntryContractGate.reason,
|
|
3622
|
+
artifactPaths: rootCauseEntryContractGate.evidenceRefs,
|
|
3623
|
+
recordedAt: rootCauseEntryContractGate.recordedAt,
|
|
3624
|
+
metadata: rootCauseEntryContractGate.metadata
|
|
3625
|
+
});
|
|
3626
|
+
}
|
|
3627
|
+
var cost = collectUsageEvents(asArray(input.usageLedger), events);
|
|
3628
|
+
var costGate = costObservabilityGate(cost, 'support_ticket', input.now);
|
|
3629
|
+
gates.push(costGate);
|
|
3630
|
+
pushEvent(events, {
|
|
3631
|
+
type: 'usage',
|
|
3632
|
+
category: 'cost_observability',
|
|
3633
|
+
message: costGate.reason,
|
|
3634
|
+
artifactPaths: costGate.evidenceRefs,
|
|
3635
|
+
recordedAt: costGate.recordedAt,
|
|
3636
|
+
metadata: costGate.metadata
|
|
3637
|
+
});
|
|
3638
|
+
var preflightGateSource = supportPreflightGateObject(ticket, job, evidence);
|
|
3639
|
+
var preflightGate = supportPreflightGateResult(preflightGateSource, input.now);
|
|
3640
|
+
if (preflightGate) {
|
|
3641
|
+
gates.push(preflightGate);
|
|
3642
|
+
pushEvent(events, {
|
|
3643
|
+
type: ((_c = preflightGate.metadata) === null || _c === void 0 ? void 0 : _c.failureClass) === 'compile' || preflightGateSource.status === 'compile_failed' ? 'qa_compile' : 'qa_infra',
|
|
3644
|
+
category: 'support_preflight_gate',
|
|
3645
|
+
message: preflightGate.reason,
|
|
3646
|
+
artifactPaths: preflightGate.evidenceRefs,
|
|
3647
|
+
recordedAt: preflightGate.recordedAt,
|
|
3648
|
+
metadata: preflightGate.metadata
|
|
3649
|
+
});
|
|
3650
|
+
}
|
|
3651
|
+
var diagnosisGate = evidenceObject(job.supportV5DiagnosisGate, job.support_v5_diagnosis_gate, job.diagnosisGate, ticket.supportV5DiagnosisGate, ticket.diagnosisGate, evidence.diagnosisGate, evidence.supportV5DiagnosisGate);
|
|
3652
|
+
var diagnosisEvidencePackSource = supportDiagnosisEvidencePackObject(ticket, job, evidence);
|
|
3653
|
+
var similarFixHints = supportSimilarFixHintsObject(ticket, job, evidence);
|
|
3654
|
+
var diagnosisEvidencePack = Object.keys(diagnosisEvidencePackSource).length
|
|
3655
|
+
? diagnosisEvidencePackSource
|
|
3656
|
+
: (Object.keys(diagnosisGate).length || Object.keys(similarFixHints).length)
|
|
3657
|
+
? (0, support_runner_v5_1.buildResolveIOSupportDiagnosisEvidencePack)({
|
|
3658
|
+
diagnosisGate: diagnosisGate,
|
|
3659
|
+
similarCaseHints: similarFixHints,
|
|
3660
|
+
issueClass: diagnosisGate.issue_class || diagnosisGate.issueClass,
|
|
3661
|
+
ownerFiles: diagnosisGate.owner_files || diagnosisGate.ownerFiles,
|
|
3662
|
+
text: [
|
|
3663
|
+
ticket.title,
|
|
3664
|
+
ticket.subject,
|
|
3665
|
+
ticket.summary,
|
|
3666
|
+
job.title,
|
|
3667
|
+
job.summary
|
|
3668
|
+
].filter(Boolean).join(' '),
|
|
3669
|
+
now: input.now
|
|
3670
|
+
})
|
|
3671
|
+
: {};
|
|
3672
|
+
var diagnosisEvidencePackGate = supportDiagnosisEvidencePackGate(diagnosisEvidencePack, input.now);
|
|
3673
|
+
if (diagnosisEvidencePackGate) {
|
|
3674
|
+
gates.push(diagnosisEvidencePackGate);
|
|
3675
|
+
pushEvent(events, {
|
|
3676
|
+
type: 'log',
|
|
3677
|
+
category: 'support_diagnosis_evidence_pack',
|
|
3678
|
+
message: diagnosisEvidencePackGate.reason,
|
|
3679
|
+
artifactPaths: diagnosisEvidencePackGate.evidenceRefs,
|
|
3680
|
+
recordedAt: diagnosisEvidencePackGate.recordedAt,
|
|
3681
|
+
metadata: diagnosisEvidencePackGate.metadata
|
|
3682
|
+
});
|
|
3683
|
+
}
|
|
3684
|
+
var issueClassProbePlanSource = supportIssueClassProbePlanObject(ticket, job, evidence);
|
|
3685
|
+
var issueClassProbePlan = Object.keys(issueClassProbePlanSource).length
|
|
3686
|
+
? issueClassProbePlanSource
|
|
3687
|
+
: Object.keys(diagnosisGate).length
|
|
3688
|
+
? (0, support_runner_v5_1.buildResolveIOSupportIssueClassProbePlan)(diagnosisGate, input.now)
|
|
3689
|
+
: {};
|
|
3690
|
+
var issueClassProbePlanRequired = nextActionContractRequired || Object.keys(diagnosisGate).length > 0;
|
|
3691
|
+
var issueClassProbePlanGate = supportIssueClassProbePlanGate(issueClassProbePlan, diagnosisGate, input.now, issueClassProbePlanRequired);
|
|
3692
|
+
if (issueClassProbePlanGate) {
|
|
3693
|
+
gates.push(issueClassProbePlanGate);
|
|
3694
|
+
pushEvent(events, {
|
|
3695
|
+
type: 'log',
|
|
3696
|
+
category: 'support_issue_class_probe_plan',
|
|
3697
|
+
message: issueClassProbePlanGate.reason,
|
|
3698
|
+
artifactPaths: issueClassProbePlanGate.evidenceRefs,
|
|
3699
|
+
recordedAt: issueClassProbePlanGate.recordedAt,
|
|
3700
|
+
metadata: issueClassProbePlanGate.metadata
|
|
3701
|
+
});
|
|
3702
|
+
}
|
|
3703
|
+
var productRepairEvidence = supportProductRepairEvidence(input, evidence);
|
|
3704
|
+
var diagnosisBeforeRepairGate = supportDiagnosisBeforeRepairGate(diagnosisGate, productRepairEvidence, input.now);
|
|
3705
|
+
if (diagnosisBeforeRepairGate) {
|
|
3706
|
+
gates.push(diagnosisBeforeRepairGate);
|
|
3707
|
+
pushEvent(events, {
|
|
3708
|
+
type: 'log',
|
|
3709
|
+
category: 'support_diagnosis_before_repair',
|
|
3710
|
+
message: diagnosisBeforeRepairGate.reason,
|
|
3711
|
+
artifactPaths: diagnosisBeforeRepairGate.evidenceRefs,
|
|
3712
|
+
recordedAt: diagnosisBeforeRepairGate.recordedAt,
|
|
3713
|
+
metadata: diagnosisBeforeRepairGate.metadata
|
|
3714
|
+
});
|
|
3715
|
+
}
|
|
3716
|
+
var ownerFileScopeGate = supportOwnerFileScopeGate(diagnosisGate, productRepairEvidence, input.now);
|
|
3717
|
+
if (ownerFileScopeGate) {
|
|
3718
|
+
gates.push(ownerFileScopeGate);
|
|
3719
|
+
pushEvent(events, {
|
|
3720
|
+
type: 'log',
|
|
3721
|
+
category: 'support_owner_file_scope',
|
|
3722
|
+
message: ownerFileScopeGate.reason,
|
|
3723
|
+
artifactPaths: ownerFileScopeGate.evidenceRefs,
|
|
3724
|
+
recordedAt: ownerFileScopeGate.recordedAt,
|
|
3725
|
+
metadata: ownerFileScopeGate.metadata
|
|
3726
|
+
});
|
|
3727
|
+
}
|
|
3728
|
+
var qa = applySupportDiagnosisProofGate(buildQaFromEvidence(evidence, input.now), diagnosisGate, input.now);
|
|
3729
|
+
var diagnosisOwnerFiles = asArray(diagnosisGate.owner_files || diagnosisGate.ownerFiles);
|
|
3730
|
+
var diagnosisIssueClass = cleanText(diagnosisGate.issue_class || diagnosisGate.issueClass, 120);
|
|
3731
|
+
if (Object.keys(diagnosisGate).length) {
|
|
3732
|
+
pushEvent(events, {
|
|
3733
|
+
type: 'log',
|
|
3734
|
+
category: 'diagnosis_gate',
|
|
3735
|
+
message: cleanText(((_d = diagnosisGate.accepted_hypothesis) === null || _d === void 0 ? void 0 : _d.statement) || ((_e = diagnosisGate.acceptedHypothesis) === null || _e === void 0 ? void 0 : _e.statement) || diagnosisGate.summary || 'Support diagnosis gate recorded.', 1800),
|
|
3736
|
+
metadata: {
|
|
3737
|
+
status: diagnosisGate.status,
|
|
3738
|
+
issueClass: diagnosisIssueClass,
|
|
3739
|
+
ownerFiles: diagnosisOwnerFiles
|
|
3740
|
+
}
|
|
3741
|
+
});
|
|
3742
|
+
}
|
|
3743
|
+
return (0, ai_run_evidence_1.buildAIRun)({
|
|
3744
|
+
source: 'support_ticket',
|
|
3745
|
+
sourceIds: sourceIds,
|
|
3746
|
+
title: firstText(ticket, ['title', 'subject', 'summary']) || firstText(job, ['title', 'summary']),
|
|
3747
|
+
status: firstText(job, ['status', 'state']) || firstText(ticket, ['status', 'state']),
|
|
3748
|
+
phase: firstText(job, ['phase', 'runnerPhase']),
|
|
3749
|
+
startedAt: dateValue(job, ['startedAt', 'createdAt']) || dateValue(ticket, ['createdAt']),
|
|
3750
|
+
completedAt: dateValue(job, ['completedAt', 'finishedAt', 'updatedAt']),
|
|
3751
|
+
events: events,
|
|
3752
|
+
gates: gates,
|
|
3753
|
+
qa: qa,
|
|
3754
|
+
cost: cost,
|
|
3755
|
+
scorecardPassed: evidence.scorecardPassed === true || evidence.scorecardStatus === 'pass',
|
|
3756
|
+
deployStatus: evidence.deployStatus,
|
|
3757
|
+
publishStatus: evidence.publishStatus,
|
|
3758
|
+
sampleDataStatus: evidence.sampleDataStatus,
|
|
3759
|
+
manualHandoff: evidence.manualHandoff === true || job.manualHandoff === true,
|
|
3760
|
+
stopped: evidence.stopped === true || job.stopped === true,
|
|
3761
|
+
rejected: evidence.rejected === true,
|
|
3762
|
+
explicitAccepted: evidence.explicitAccepted === true || ticket.accepted === true,
|
|
3763
|
+
terminal: /complete|closed|resolved|done|failed|rejected/i.test("".concat(job.status || '', " ").concat(ticket.status || '')),
|
|
3764
|
+
now: input.now,
|
|
3765
|
+
metadata: {
|
|
3766
|
+
versionCount: asArray(input.versions).length,
|
|
3767
|
+
buildPlanCount: asArray(input.buildPlans).length,
|
|
3768
|
+
costObservability: costObservabilityMetadata(costGate),
|
|
3769
|
+
hotfixDurability: hotfixDurabilityMetadata(gates),
|
|
3770
|
+
managerNoBlindLoopPolicy: managerNoBlindLoopMetadata(noBlindLoopGate),
|
|
3771
|
+
diagnosisBeforeRepair: diagnosisBeforeRepairGate ? {
|
|
3772
|
+
status: diagnosisBeforeRepairGate.status,
|
|
3773
|
+
diagnosisValid: ((_f = diagnosisBeforeRepairGate.metadata) === null || _f === void 0 ? void 0 : _f.diagnosisValid) === true,
|
|
3774
|
+
diagnosisStatus: cleanText((_g = diagnosisBeforeRepairGate.metadata) === null || _g === void 0 ? void 0 : _g.diagnosisStatus, 120),
|
|
3775
|
+
activityCount: Number(((_h = diagnosisBeforeRepairGate.metadata) === null || _h === void 0 ? void 0 : _h.activityCount) || 0),
|
|
3776
|
+
changedFiles: cleanStringList((_j = diagnosisBeforeRepairGate.metadata) === null || _j === void 0 ? void 0 : _j.changedFiles, 40, 500),
|
|
3777
|
+
allowedDispatchAction: cleanText((_k = diagnosisBeforeRepairGate.metadata) === null || _k === void 0 ? void 0 : _k.allowedDispatchAction, 160),
|
|
3778
|
+
productRepairAllowed: ((_l = diagnosisBeforeRepairGate.metadata) === null || _l === void 0 ? void 0 : _l.productRepairAllowed) === true,
|
|
3779
|
+
blockers: cleanStringList((_m = diagnosisBeforeRepairGate.metadata) === null || _m === void 0 ? void 0 : _m.blockers, 20, 500)
|
|
3780
|
+
} : undefined,
|
|
3781
|
+
ownerFileScope: ownerFileScopeGate ? {
|
|
3782
|
+
status: ownerFileScopeGate.status,
|
|
3783
|
+
productRepairAllowed: ((_o = ownerFileScopeGate.metadata) === null || _o === void 0 ? void 0 : _o.productRepairAllowed) === true,
|
|
3784
|
+
allowedDispatchAction: cleanText((_p = ownerFileScopeGate.metadata) === null || _p === void 0 ? void 0 : _p.allowedDispatchAction, 160),
|
|
3785
|
+
ownerFiles: cleanStringList((_q = ownerFileScopeGate.metadata) === null || _q === void 0 ? void 0 : _q.ownerFiles, 40, 500),
|
|
3786
|
+
changedFiles: cleanStringList((_r = ownerFileScopeGate.metadata) === null || _r === void 0 ? void 0 : _r.changedFiles, 60, 500),
|
|
3787
|
+
outsideOwnerFiles: cleanStringList((_s = ownerFileScopeGate.metadata) === null || _s === void 0 ? void 0 : _s.outsideOwnerFiles, 40, 500),
|
|
3788
|
+
allowedTestFilesOutsideOwnerScope: ((_t = ownerFileScopeGate.metadata) === null || _t === void 0 ? void 0 : _t.allowedTestFilesOutsideOwnerScope) === true,
|
|
3789
|
+
requiredEvidence: cleanStringList((_u = ownerFileScopeGate.metadata) === null || _u === void 0 ? void 0 : _u.requiredEvidence, 20, 500)
|
|
3790
|
+
} : undefined,
|
|
3791
|
+
rootCauseEntryContract: Object.keys(rootCauseEntryContract).length ? {
|
|
3792
|
+
contractId: cleanText(rootCauseEntryContract.contract_id || rootCauseEntryContract.contractId, 160),
|
|
3793
|
+
version: cleanText(rootCauseEntryContract.version, 120),
|
|
3794
|
+
status: cleanText(rootCauseEntryContract.status, 120),
|
|
3795
|
+
issueClassProbeCount: asArray(rootCauseEntryContract.issue_class_probes || rootCauseEntryContract.issueClassProbes).length,
|
|
3796
|
+
ownerFileMax: Number(((_v = rootCauseEntryContract.owner_file_policy) === null || _v === void 0 ? void 0 : _v.max_files) || ((_w = rootCauseEntryContract.ownerFilePolicy) === null || _w === void 0 ? void 0 : _w.maxFiles) || 0) || 0,
|
|
3797
|
+
requiresBusinessAssertion: ((_x = rootCauseEntryContract.business_proof_policy) === null || _x === void 0 ? void 0 : _x.requires_aiqa_business_assertion) === true
|
|
3798
|
+
|| ((_y = rootCauseEntryContract.businessProofPolicy) === null || _y === void 0 ? void 0 : _y.requiresAiqaBusinessAssertion) === true
|
|
3799
|
+
} : undefined,
|
|
3800
|
+
diagnosis: Object.keys(diagnosisGate).length ? {
|
|
3801
|
+
status: cleanText(diagnosisGate.status, 80),
|
|
3802
|
+
issueClass: diagnosisIssueClass,
|
|
3803
|
+
ownerFiles: diagnosisOwnerFiles,
|
|
3804
|
+
acceptedHypothesis: cleanText(((_z = diagnosisGate.accepted_hypothesis) === null || _z === void 0 ? void 0 : _z.statement) || ((_0 = diagnosisGate.acceptedHypothesis) === null || _0 === void 0 ? void 0 : _0.statement), 1000),
|
|
3805
|
+
proofPlan: diagnosisGate.proof_plan || diagnosisGate.proofPlan
|
|
3806
|
+
} : undefined,
|
|
3807
|
+
diagnosisEvidencePack: diagnosisEvidencePackGate ? {
|
|
3808
|
+
status: cleanText((_1 = diagnosisEvidencePackGate.metadata) === null || _1 === void 0 ? void 0 : _1.status, 120),
|
|
3809
|
+
gateStatus: diagnosisEvidencePackGate.status,
|
|
3810
|
+
packId: cleanText((_2 = diagnosisEvidencePackGate.metadata) === null || _2 === void 0 ? void 0 : _2.packId, 180),
|
|
3811
|
+
readOnly: ((_3 = diagnosisEvidencePackGate.metadata) === null || _3 === void 0 ? void 0 : _3.readOnly) !== false,
|
|
3812
|
+
sourceEditsAllowed: ((_4 = diagnosisEvidencePackGate.metadata) === null || _4 === void 0 ? void 0 : _4.sourceEditsAllowed) === true,
|
|
3813
|
+
requiredOutputKey: cleanText((_5 = diagnosisEvidencePackGate.metadata) === null || _5 === void 0 ? void 0 : _5.requiredOutputKey, 120),
|
|
3814
|
+
diagnosisValid: ((_6 = diagnosisEvidencePackGate.metadata) === null || _6 === void 0 ? void 0 : _6.diagnosisValid) === true,
|
|
3815
|
+
issueClassHint: cleanText((_7 = diagnosisEvidencePackGate.metadata) === null || _7 === void 0 ? void 0 : _7.issueClassHint, 120),
|
|
3816
|
+
ownerFileHints: cleanStringList((_8 = diagnosisEvidencePackGate.metadata) === null || _8 === void 0 ? void 0 : _8.ownerFileHints, 20, 500),
|
|
3817
|
+
similarHintCount: Number(((_9 = diagnosisEvidencePackGate.metadata) === null || _9 === void 0 ? void 0 : _9.similarHintCount) || 0),
|
|
3818
|
+
similarHintsAdvisoryOnly: ((_10 = diagnosisEvidencePackGate.metadata) === null || _10 === void 0 ? void 0 : _10.similarHintsAdvisoryOnly) === true,
|
|
3819
|
+
issueClassProbeCount: Number(((_11 = diagnosisEvidencePackGate.metadata) === null || _11 === void 0 ? void 0 : _11.issueClassProbeCount) || 0),
|
|
3820
|
+
validationBlockers: cleanStringList((_12 = diagnosisEvidencePackGate.metadata) === null || _12 === void 0 ? void 0 : _12.validationBlockers, 20, 500)
|
|
3821
|
+
} : undefined,
|
|
3822
|
+
issueClassProbePlan: issueClassProbePlanGate ? {
|
|
3823
|
+
status: cleanText((_13 = issueClassProbePlanGate.metadata) === null || _13 === void 0 ? void 0 : _13.status, 120),
|
|
3824
|
+
gateStatus: issueClassProbePlanGate.status,
|
|
3825
|
+
planId: cleanText((_14 = issueClassProbePlanGate.metadata) === null || _14 === void 0 ? void 0 : _14.planId, 180),
|
|
3826
|
+
issueClass: cleanText((_15 = issueClassProbePlanGate.metadata) === null || _15 === void 0 ? void 0 : _15.issueClass, 120),
|
|
3827
|
+
diagnosisValid: ((_16 = issueClassProbePlanGate.metadata) === null || _16 === void 0 ? void 0 : _16.diagnosisValid) === true,
|
|
3828
|
+
issueClassProbePlanReady: ((_17 = issueClassProbePlanGate.metadata) === null || _17 === void 0 ? void 0 : _17.issueClassProbePlanReady) === true,
|
|
3829
|
+
activeRoute: cleanText((_18 = issueClassProbePlanGate.metadata) === null || _18 === void 0 ? void 0 : _18.activeRoute, 500),
|
|
3830
|
+
action: cleanText((_19 = issueClassProbePlanGate.metadata) === null || _19 === void 0 ? void 0 : _19.action, 1000),
|
|
3831
|
+
expectedBusinessProof: cleanText((_20 = issueClassProbePlanGate.metadata) === null || _20 === void 0 ? void 0 : _20.expectedBusinessProof, 1200),
|
|
3832
|
+
acceptanceGate: cleanText((_21 = issueClassProbePlanGate.metadata) === null || _21 === void 0 ? void 0 : _21.acceptanceGate, 120),
|
|
3833
|
+
requiredArtifacts: cleanStringList((_22 = issueClassProbePlanGate.metadata) === null || _22 === void 0 ? void 0 : _22.requiredArtifacts, 20, 500),
|
|
3834
|
+
falsePassBlockers: cleanStringList((_23 = issueClassProbePlanGate.metadata) === null || _23 === void 0 ? void 0 : _23.falsePassBlockers, 20, 500),
|
|
3835
|
+
blockers: cleanStringList((_24 = issueClassProbePlanGate.metadata) === null || _24 === void 0 ? void 0 : _24.blockers, 20, 500)
|
|
3836
|
+
} : undefined,
|
|
3837
|
+
businessProofReadiness: Object.keys(businessProofReadiness).length ? {
|
|
3838
|
+
ready: businessProofReadiness.ready === true,
|
|
3839
|
+
status: cleanText(businessProofReadiness.status, 120),
|
|
3840
|
+
reason: cleanText(businessProofReadiness.reason, 1000),
|
|
3841
|
+
blockers: cleanStringList(businessProofReadiness.blockers, 20, 500)
|
|
3842
|
+
} : undefined,
|
|
3843
|
+
nextActionContract: nextActionContractGate ? {
|
|
3844
|
+
status: nextActionContractGate.status,
|
|
3845
|
+
action: cleanText((_25 = nextActionContractGate.metadata) === null || _25 === void 0 ? void 0 : _25.action, 160),
|
|
3846
|
+
primaryCommand: cleanText((_26 = nextActionContractGate.metadata) === null || _26 === void 0 ? void 0 : _26.primaryCommand, 240),
|
|
3847
|
+
safeToAutoRun: ((_27 = nextActionContractGate.metadata) === null || _27 === void 0 ? void 0 : _27.safeToAutoRun) === true,
|
|
3848
|
+
canRunWithoutCodexMonitor: ((_28 = nextActionContractGate.metadata) === null || _28 === void 0 ? void 0 : _28.canRunWithoutCodexMonitor) === true,
|
|
3849
|
+
codexFallbackRequired: ((_29 = nextActionContractGate.metadata) === null || _29 === void 0 ? void 0 : _29.codexFallbackRequired) === true,
|
|
3850
|
+
requiresHumanApproval: ((_30 = nextActionContractGate.metadata) === null || _30 === void 0 ? void 0 : _30.requiresHumanApproval) === true,
|
|
3851
|
+
rootCauseFirstSatisfied: ((_31 = nextActionContractGate.metadata) === null || _31 === void 0 ? void 0 : _31.rootCauseFirstSatisfied) === true,
|
|
3852
|
+
hotfixCommitRequired: ((_32 = nextActionContractGate.metadata) === null || _32 === void 0 ? void 0 : _32.hotfixCommitRequired) === true,
|
|
3853
|
+
liveHotfixBlockedUntilCommit: ((_33 = nextActionContractGate.metadata) === null || _33 === void 0 ? void 0 : _33.liveHotfixBlockedUntilCommit) === true,
|
|
3854
|
+
failureClass: cleanText((_34 = nextActionContractGate.metadata) === null || _34 === void 0 ? void 0 : _34.failureClass, 120),
|
|
3855
|
+
evidenceFreshnessStatus: cleanText((_35 = nextActionContractGate.metadata) === null || _35 === void 0 ? void 0 : _35.evidenceFreshnessStatus, 120),
|
|
3856
|
+
sameFailureCount: Number(((_36 = nextActionContractGate.metadata) === null || _36 === void 0 ? void 0 : _36.sameFailureCount) || 0),
|
|
3857
|
+
blockers: cleanStringList((_37 = nextActionContractGate.metadata) === null || _37 === void 0 ? void 0 : _37.blockers, 20, 500)
|
|
3858
|
+
} : undefined,
|
|
3859
|
+
managerExecutionPacket: managerExecutionPacketGate ? {
|
|
3860
|
+
status: cleanText((_38 = managerExecutionPacketGate.metadata) === null || _38 === void 0 ? void 0 : _38.status, 120),
|
|
3861
|
+
gateStatus: managerExecutionPacketGate.status,
|
|
3862
|
+
action: cleanText((_39 = managerExecutionPacketGate.metadata) === null || _39 === void 0 ? void 0 : _39.action, 160),
|
|
3863
|
+
primaryCommand: cleanText((_40 = managerExecutionPacketGate.metadata) === null || _40 === void 0 ? void 0 : _40.primaryCommand, 240),
|
|
3864
|
+
executeNow: ((_41 = managerExecutionPacketGate.metadata) === null || _41 === void 0 ? void 0 : _41.executeNow) === true,
|
|
3865
|
+
canRunWithoutCodexMonitor: ((_42 = managerExecutionPacketGate.metadata) === null || _42 === void 0 ? void 0 : _42.canRunWithoutCodexMonitor) === true,
|
|
3866
|
+
codexFallbackRequired: ((_43 = managerExecutionPacketGate.metadata) === null || _43 === void 0 ? void 0 : _43.codexFallbackRequired) === true,
|
|
3867
|
+
retryScope: cleanText((_44 = managerExecutionPacketGate.metadata) === null || _44 === void 0 ? void 0 : _44.retryScope, 120),
|
|
3868
|
+
maxAttemptsBeforeFreshEvidence: Number(((_45 = managerExecutionPacketGate.metadata) === null || _45 === void 0 ? void 0 : _45.maxAttemptsBeforeFreshEvidence) || 0),
|
|
3869
|
+
costRisk: cleanText((_46 = managerExecutionPacketGate.metadata) === null || _46 === void 0 ? void 0 : _46.costRisk, 120),
|
|
3870
|
+
validationStatus: cleanText((_48 = (_47 = managerExecutionPacketGate.metadata) === null || _47 === void 0 ? void 0 : _47.validation) === null || _48 === void 0 ? void 0 : _48.status, 120),
|
|
3871
|
+
validationValid: ((_50 = (_49 = managerExecutionPacketGate.metadata) === null || _49 === void 0 ? void 0 : _49.validation) === null || _50 === void 0 ? void 0 : _50.valid) === true,
|
|
3872
|
+
proofRequiredBeforeContinuation: cleanStringList((_51 = managerExecutionPacketGate.metadata) === null || _51 === void 0 ? void 0 : _51.proofRequiredBeforeContinuation, 20, 500),
|
|
3873
|
+
stopConditions: cleanStringList((_52 = managerExecutionPacketGate.metadata) === null || _52 === void 0 ? void 0 : _52.stopConditions, 20, 500),
|
|
3874
|
+
forbiddenActions: cleanStringList((_53 = managerExecutionPacketGate.metadata) === null || _53 === void 0 ? void 0 : _53.forbiddenActions, 20, 500),
|
|
3875
|
+
ownerFiles: cleanStringList((_54 = managerExecutionPacketGate.metadata) === null || _54 === void 0 ? void 0 : _54.ownerFiles, 40, 500),
|
|
3876
|
+
blockers: cleanStringList((_55 = managerExecutionPacketGate.metadata) === null || _55 === void 0 ? void 0 : _55.blockers, 20, 500)
|
|
3877
|
+
} : undefined,
|
|
3878
|
+
managerRecoveryExecutionProof: recoveryExecutionProofGate ? {
|
|
3879
|
+
status: cleanText((_56 = recoveryExecutionProofGate.metadata) === null || _56 === void 0 ? void 0 : _56.status, 120),
|
|
3880
|
+
gateStatus: recoveryExecutionProofGate.status,
|
|
3881
|
+
canContinueRun: ((_57 = recoveryExecutionProofGate.metadata) === null || _57 === void 0 ? void 0 : _57.canContinueRun) === true,
|
|
3882
|
+
canRunProductRepair: ((_58 = recoveryExecutionProofGate.metadata) === null || _58 === void 0 ? void 0 : _58.canRunProductRepair) === true,
|
|
3883
|
+
canRunExpensiveModel: ((_59 = recoveryExecutionProofGate.metadata) === null || _59 === void 0 ? void 0 : _59.canRunExpensiveModel) === true,
|
|
3884
|
+
canResetLoopBudget: ((_60 = recoveryExecutionProofGate.metadata) === null || _60 === void 0 ? void 0 : _60.canResetLoopBudget) === true,
|
|
3885
|
+
newEvidence: ((_61 = recoveryExecutionProofGate.metadata) === null || _61 === void 0 ? void 0 : _61.newEvidence) === true,
|
|
3886
|
+
materialEvidence: ((_62 = recoveryExecutionProofGate.metadata) === null || _62 === void 0 ? void 0 : _62.materialEvidence) === true,
|
|
3887
|
+
evidenceStrength: cleanText((_63 = recoveryExecutionProofGate.metadata) === null || _63 === void 0 ? void 0 : _63.evidenceStrength, 120),
|
|
3888
|
+
nextAllowedAction: cleanText((_64 = recoveryExecutionProofGate.metadata) === null || _64 === void 0 ? void 0 : _64.nextAllowedAction, 180),
|
|
3889
|
+
missingEvidence: cleanStringList((_65 = recoveryExecutionProofGate.metadata) === null || _65 === void 0 ? void 0 : _65.missingEvidence, 20, 500),
|
|
3890
|
+
blockers: cleanStringList((_66 = recoveryExecutionProofGate.metadata) === null || _66 === void 0 ? void 0 : _66.blockers, 20, 500)
|
|
3891
|
+
} : undefined,
|
|
3892
|
+
customerReplyPolicy: Object.keys(customerReplyPolicy).length ? {
|
|
3893
|
+
action: cleanText(customerReplyPolicy.action, 120),
|
|
3894
|
+
safety: cleanText(customerReplyPolicy.safety, 120),
|
|
3895
|
+
canDraftCustomerReply: customerReplyPolicy.canDraftCustomerReply === true || customerReplyPolicy.can_draft_customer_reply === true,
|
|
3896
|
+
canSendCustomerReply: customerReplyPolicy.canSendCustomerReply === true || customerReplyPolicy.can_send_customer_reply === true,
|
|
3897
|
+
reason: cleanText(customerReplyPolicy.reason, 1000),
|
|
3898
|
+
reviewType: cleanText(((_67 = customerReplyPolicy.humanReviewPacket) === null || _67 === void 0 ? void 0 : _67.reviewType)
|
|
3899
|
+
|| ((_68 = customerReplyPolicy.human_review_packet) === null || _68 === void 0 ? void 0 : _68.review_type)
|
|
3900
|
+
|| ((_69 = customerReplyPolicy.human_review_packet) === null || _69 === void 0 ? void 0 : _69.reviewType), 160),
|
|
3901
|
+
primaryAction: cleanText(((_70 = customerReplyPolicy.humanReviewPacket) === null || _70 === void 0 ? void 0 : _70.primaryAction)
|
|
3902
|
+
|| ((_71 = customerReplyPolicy.human_review_packet) === null || _71 === void 0 ? void 0 : _71.primary_action)
|
|
3903
|
+
|| ((_72 = customerReplyPolicy.human_review_packet) === null || _72 === void 0 ? void 0 : _72.primaryAction), 160),
|
|
3904
|
+
clarificationContract: customerReplyPolicy.clarificationContract || customerReplyPolicy.clarification_contract ? {
|
|
3905
|
+
status: cleanText(((_73 = customerReplyPolicy.clarificationContract) === null || _73 === void 0 ? void 0 : _73.status) || ((_74 = customerReplyPolicy.clarification_contract) === null || _74 === void 0 ? void 0 : _74.status), 120),
|
|
3906
|
+
missingField: cleanText(((_75 = customerReplyPolicy.clarificationContract) === null || _75 === void 0 ? void 0 : _75.missingField) || ((_76 = customerReplyPolicy.clarification_contract) === null || _76 === void 0 ? void 0 : _76.missing_field), 120),
|
|
3907
|
+
oneQuestionOnly: ((_77 = customerReplyPolicy.clarificationContract) === null || _77 === void 0 ? void 0 : _77.oneQuestionOnly) === true || ((_78 = customerReplyPolicy.clarification_contract) === null || _78 === void 0 ? void 0 : _78.one_question_only) === true,
|
|
3908
|
+
parksTicketUntilCustomerReply: ((_79 = customerReplyPolicy.clarificationContract) === null || _79 === void 0 ? void 0 : _79.parksTicketUntilCustomerReply) === true || ((_80 = customerReplyPolicy.clarification_contract) === null || _80 === void 0 ? void 0 : _80.parks_ticket_until_customer_reply) === true
|
|
3909
|
+
} : undefined
|
|
3910
|
+
} : undefined,
|
|
3911
|
+
customerReplyReadiness: customerReplyReadinessGate ? {
|
|
3912
|
+
status: cleanText((_81 = customerReplyReadinessGate.metadata) === null || _81 === void 0 ? void 0 : _81.status, 120),
|
|
3913
|
+
gateStatus: customerReplyReadinessGate.status,
|
|
3914
|
+
primaryCommand: cleanText((_82 = customerReplyReadinessGate.metadata) === null || _82 === void 0 ? void 0 : _82.primaryCommand, 180),
|
|
3915
|
+
policyAction: cleanText((_83 = customerReplyReadinessGate.metadata) === null || _83 === void 0 ? void 0 : _83.policyAction, 120),
|
|
3916
|
+
canDraftCustomerReply: ((_84 = customerReplyReadinessGate.metadata) === null || _84 === void 0 ? void 0 : _84.canDraftCustomerReply) === true,
|
|
3917
|
+
canSendCustomerReply: ((_85 = customerReplyReadinessGate.metadata) === null || _85 === void 0 ? void 0 : _85.canSendCustomerReply) === true,
|
|
3918
|
+
requiresHumanApproval: ((_86 = customerReplyReadinessGate.metadata) === null || _86 === void 0 ? void 0 : _86.requiresHumanApproval) === true,
|
|
3919
|
+
proofBacked: ((_87 = customerReplyReadinessGate.metadata) === null || _87 === void 0 ? void 0 : _87.proofBacked) === true,
|
|
3920
|
+
businessProofReady: ((_88 = customerReplyReadinessGate.metadata) === null || _88 === void 0 ? void 0 : _88.businessProofReady) === true,
|
|
3921
|
+
releaseReady: ((_89 = customerReplyReadinessGate.metadata) === null || _89 === void 0 ? void 0 : _89.releaseReady) === true,
|
|
3922
|
+
blockers: cleanStringList((_90 = customerReplyReadinessGate.metadata) === null || _90 === void 0 ? void 0 : _90.blockers, 20, 500)
|
|
3923
|
+
} : undefined
|
|
3924
|
+
}
|
|
3925
|
+
});
|
|
3926
|
+
}
|
|
3927
|
+
function buildAICoderAIRunFromEvidence(input) {
|
|
3928
|
+
var e_34, _a;
|
|
3929
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30;
|
|
3930
|
+
var app = input.app || {};
|
|
3931
|
+
var job = input.job || {};
|
|
3932
|
+
var evidence = buildAICoderQaEvidence(input);
|
|
3933
|
+
var events = [];
|
|
3934
|
+
var gates = [];
|
|
3935
|
+
var sourceIds = {};
|
|
3936
|
+
addSourceId(sourceIds, 'appId', app._id || app.id || job.appId || job.aicoderAppId);
|
|
3937
|
+
addSourceId(sourceIds, 'jobId', job._id || job.id || job.jobId);
|
|
3938
|
+
addSourceId(sourceIds, 'domain', app.domain || app.customDomain || job.domain);
|
|
3939
|
+
try {
|
|
3940
|
+
for (var _31 = __values(asArray(input.logs)), _32 = _31.next(); !_32.done; _32 = _31.next()) {
|
|
3941
|
+
var log = _32.value;
|
|
3942
|
+
pushEvent(events, {
|
|
3943
|
+
type: log.type === 'scorecard' ? 'scorecard' : 'log',
|
|
3944
|
+
category: cleanText(log.category || log.phase || log.level, 160),
|
|
3945
|
+
message: cleanText(log.message || log.summary || log.text || log.title, 1800),
|
|
3946
|
+
artifactPaths: asArray(log.artifactPaths || log.artifacts),
|
|
3947
|
+
recordedAt: eventDate(log),
|
|
3948
|
+
metadata: {
|
|
3949
|
+
status: log.status,
|
|
3950
|
+
level: log.level,
|
|
3951
|
+
score: log.score
|
|
3952
|
+
}
|
|
3953
|
+
});
|
|
3954
|
+
}
|
|
3955
|
+
}
|
|
3956
|
+
catch (e_34_1) { e_34 = { error: e_34_1 }; }
|
|
3957
|
+
finally {
|
|
3958
|
+
try {
|
|
3959
|
+
if (_32 && !_32.done && (_a = _31.return)) _a.call(_31);
|
|
3960
|
+
}
|
|
3961
|
+
finally { if (e_34) throw e_34.error; }
|
|
3962
|
+
}
|
|
3963
|
+
collectCommitEvents(asArray(input.commits), events);
|
|
3964
|
+
collectHotfixEvidenceEvents([job, app, evidence, input.qaEvidence], events, gates, input.now);
|
|
3965
|
+
var noBlindLoopGate = aicoderManagerNoBlindLoopGate(app, job, evidence, input.now);
|
|
3966
|
+
if (noBlindLoopGate) {
|
|
3967
|
+
gates.push(noBlindLoopGate);
|
|
3968
|
+
pushEvent(events, {
|
|
3969
|
+
type: 'log',
|
|
3970
|
+
category: 'manager_no_blind_loop_policy',
|
|
3971
|
+
message: noBlindLoopGate.reason,
|
|
3972
|
+
artifactPaths: noBlindLoopGate.evidenceRefs,
|
|
3973
|
+
recordedAt: noBlindLoopGate.recordedAt,
|
|
3974
|
+
metadata: noBlindLoopGate.metadata
|
|
3975
|
+
});
|
|
3976
|
+
}
|
|
3977
|
+
var cost = collectUsageEvents(asArray(input.usageLedger), events);
|
|
3978
|
+
var costGate = costObservabilityGate(cost, 'aicoder_app', input.now);
|
|
3979
|
+
gates.push(costGate);
|
|
3980
|
+
pushEvent(events, {
|
|
3981
|
+
type: 'usage',
|
|
3982
|
+
category: 'cost_observability',
|
|
3983
|
+
message: costGate.reason,
|
|
3984
|
+
artifactPaths: costGate.evidenceRefs,
|
|
3985
|
+
recordedAt: costGate.recordedAt,
|
|
3986
|
+
metadata: costGate.metadata
|
|
3987
|
+
});
|
|
3988
|
+
var journeyContractValidation = aicoderJourneyContractValidationFromEvidence(evidence);
|
|
3989
|
+
var journeyContractGate = aicoderJourneyContractGate(journeyContractValidation, evidence, input.now);
|
|
3990
|
+
gates.push(journeyContractGate);
|
|
3991
|
+
pushEvent(events, {
|
|
3992
|
+
type: 'log',
|
|
3993
|
+
category: 'aicoder_journey_contract',
|
|
3994
|
+
message: journeyContractGate.reason,
|
|
3995
|
+
artifactPaths: journeyContractGate.evidenceRefs,
|
|
3996
|
+
recordedAt: journeyContractGate.recordedAt,
|
|
3997
|
+
metadata: journeyContractGate.metadata
|
|
3998
|
+
});
|
|
3999
|
+
var scorecardPassed = evidence.scorecardPassed === true
|
|
4000
|
+
|| evidence.scorecardStatus === 'pass'
|
|
4001
|
+
|| (Number((_c = (_b = evidence.score) !== null && _b !== void 0 ? _b : evidence.qualityScore) !== null && _c !== void 0 ? _c : 0) >= Number((_e = (_d = evidence.scoreThreshold) !== null && _d !== void 0 ? _d : job.scoreThreshold) !== null && _e !== void 0 ? _e : 90));
|
|
4002
|
+
var explicitWorkflowReadiness = normalizeAICoderWorkflowProofReadiness(plainObject(evidence.workflowProofReadiness
|
|
4003
|
+
|| evidence.workflow_proof_readiness
|
|
4004
|
+
|| evidence.aicoderWorkflowProofReadiness
|
|
4005
|
+
|| evidence.aicoder_workflow_proof_readiness
|
|
4006
|
+
|| job.workflowProofReadiness
|
|
4007
|
+
|| job.workflow_proof_readiness
|
|
4008
|
+
|| job.aicoderWorkflowProofReadiness
|
|
4009
|
+
|| job.aicoder_workflow_proof_readiness), input.now);
|
|
4010
|
+
var workflowReadiness = explicitWorkflowReadiness || (0, aicoder_runner_v6_1.evaluateResolveIOAICoderWorkflowProofReadiness)({
|
|
4011
|
+
journeyContract: evidence.journeyContract,
|
|
4012
|
+
journeyContractMarkdown: evidence.journeyContractMarkdown,
|
|
4013
|
+
workflowQaRows: asArray(evidence.workflowQaRows || evidence.workflow_qa_rows),
|
|
4014
|
+
businessAssertions: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(asArray(evidence.businessAssertions)), false), __read(asArray(evidence.business_assertions)), false), __read(asArray(evidence.workflowAssertions)), false), __read(asArray(evidence.workflow_assertions)), false),
|
|
4015
|
+
routeProbes: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(asArray(evidence.routeProbes)), false), __read(asArray(evidence.route_probes)), false), __read(asArray(evidence.workflowProbes)), false), __read(asArray(evidence.workflow_probes)), false),
|
|
4016
|
+
artifactPaths: __spreadArray(__spreadArray([], __read(asArray(evidence.artifactPaths)), false), __read(asArray(evidence.artifact_paths)), false),
|
|
4017
|
+
scorecardPassed: scorecardPassed,
|
|
4018
|
+
deployStatus: evidence.deployStatus,
|
|
4019
|
+
publishStatus: evidence.publishStatus,
|
|
4020
|
+
sampleDataStatus: evidence.sampleDataStatus,
|
|
4021
|
+
previousWorkflowProofFingerprint: firstNonEmptyText([
|
|
4022
|
+
evidence.previousWorkflowProofFingerprint,
|
|
4023
|
+
evidence.previous_workflow_proof_fingerprint,
|
|
4024
|
+
job.previousWorkflowProofFingerprint,
|
|
4025
|
+
job.previous_workflow_proof_fingerprint,
|
|
4026
|
+
app.previousWorkflowProofFingerprint,
|
|
4027
|
+
app.previous_workflow_proof_fingerprint
|
|
4028
|
+
], 200),
|
|
4029
|
+
previousArtifactFingerprint: firstNonEmptyText([
|
|
4030
|
+
evidence.previousArtifactFingerprint,
|
|
4031
|
+
evidence.previous_artifact_fingerprint,
|
|
4032
|
+
job.previousArtifactFingerprint,
|
|
4033
|
+
job.previous_artifact_fingerprint,
|
|
4034
|
+
app.previousArtifactFingerprint,
|
|
4035
|
+
app.previous_artifact_fingerprint
|
|
4036
|
+
], 200),
|
|
4037
|
+
previousWorkflowProofFingerprints: __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(asArray(evidence.previousWorkflowProofFingerprints)), false), __read(asArray(evidence.previous_workflow_proof_fingerprints)), false), __read(asArray(job.previousWorkflowProofFingerprints)), false), __read(asArray(job.previous_workflow_proof_fingerprints)), false), __read(asArray(app.previousWorkflowProofFingerprints)), false), __read(asArray(app.previous_workflow_proof_fingerprints)), false),
|
|
4038
|
+
previousArtifactFingerprints: __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(asArray(evidence.previousArtifactFingerprints)), false), __read(asArray(evidence.previous_artifact_fingerprints)), false), __read(asArray(job.previousArtifactFingerprints)), false), __read(asArray(job.previous_artifact_fingerprints)), false), __read(asArray(app.previousArtifactFingerprints)), false), __read(asArray(app.previous_artifact_fingerprints)), false),
|
|
4039
|
+
now: input.now
|
|
4040
|
+
});
|
|
4041
|
+
var workflowReadinessGate = aicoderWorkflowProofReadinessGate(workflowReadiness, input.now);
|
|
4042
|
+
gates.push(workflowReadinessGate);
|
|
4043
|
+
pushEvent(events, {
|
|
4044
|
+
type: 'qa_business_assertion',
|
|
4045
|
+
category: 'aicoder_workflow_proof_readiness',
|
|
4046
|
+
message: workflowReadinessGate.reason,
|
|
4047
|
+
artifactPaths: workflowReadinessGate.evidenceRefs,
|
|
4048
|
+
recordedAt: workflowReadinessGate.recordedAt,
|
|
4049
|
+
metadata: workflowReadinessGate.metadata
|
|
4050
|
+
});
|
|
4051
|
+
var workflowProofCheckpoint = aicoderWorkflowProofCheckpointObject(app, job, evidence);
|
|
4052
|
+
var workflowProofCheckpointGate = aicoderWorkflowProofCheckpointGate(workflowProofCheckpoint, input.now);
|
|
4053
|
+
if (workflowProofCheckpointGate) {
|
|
4054
|
+
gates.push(workflowProofCheckpointGate);
|
|
4055
|
+
pushEvent(events, {
|
|
4056
|
+
type: 'log',
|
|
4057
|
+
category: 'aicoder_workflow_proof_checkpoint',
|
|
4058
|
+
message: workflowProofCheckpointGate.reason,
|
|
4059
|
+
artifactPaths: workflowProofCheckpointGate.evidenceRefs,
|
|
4060
|
+
recordedAt: workflowProofCheckpointGate.recordedAt,
|
|
4061
|
+
metadata: workflowProofCheckpointGate.metadata
|
|
4062
|
+
});
|
|
4063
|
+
}
|
|
4064
|
+
var nextActionContract = aicoderNextActionContractObject(app, job, evidence);
|
|
4065
|
+
var nextActionContractGate = aicoderNextActionContractGate(nextActionContract, input.now);
|
|
4066
|
+
if (nextActionContractGate) {
|
|
4067
|
+
gates.push(nextActionContractGate);
|
|
4068
|
+
pushEvent(events, {
|
|
4069
|
+
type: 'log',
|
|
4070
|
+
category: 'aicoder_next_action_contract',
|
|
4071
|
+
message: nextActionContractGate.reason,
|
|
4072
|
+
artifactPaths: nextActionContractGate.evidenceRefs,
|
|
4073
|
+
recordedAt: nextActionContractGate.recordedAt,
|
|
4074
|
+
metadata: nextActionContractGate.metadata
|
|
4075
|
+
});
|
|
4076
|
+
}
|
|
4077
|
+
var qa = applyAICoderWorkflowProofGate(buildQaFromEvidence(evidence, input.now), workflowReadiness, input.now);
|
|
4078
|
+
return (0, ai_run_evidence_1.buildAIRun)({
|
|
4079
|
+
source: 'aicoder_app',
|
|
4080
|
+
sourceIds: sourceIds,
|
|
4081
|
+
title: firstText(app, ['name', 'title']) || firstText(job, ['appName', 'title', 'goal']),
|
|
4082
|
+
status: firstText(job, ['status', 'state']) || firstText(app, ['status', 'state']),
|
|
4083
|
+
phase: firstText(job, ['phase', 'runnerPhase']),
|
|
4084
|
+
startedAt: dateValue(job, ['startedAt', 'createdAt']) || dateValue(app, ['createdAt']),
|
|
4085
|
+
completedAt: dateValue(job, ['completedAt', 'finishedAt', 'updatedAt']),
|
|
4086
|
+
events: events,
|
|
4087
|
+
gates: gates,
|
|
4088
|
+
qa: qa,
|
|
4089
|
+
cost: cost,
|
|
4090
|
+
scorecardPassed: scorecardPassed,
|
|
4091
|
+
deployStatus: evidence.deployStatus || statusFromBoolean(evidence.deployReady),
|
|
4092
|
+
publishStatus: evidence.publishStatus || evidence.pullRequestStatus,
|
|
4093
|
+
sampleDataStatus: evidence.sampleDataStatus || statusFromBoolean((_f = evidence.sampleDataReady) !== null && _f !== void 0 ? _f : evidence.hasSampleData),
|
|
4094
|
+
manualHandoff: evidence.manualHandoff === true || job.manualHandoff === true,
|
|
4095
|
+
stopped: evidence.stopped === true || job.stopped === true,
|
|
4096
|
+
rejected: evidence.rejected === true,
|
|
4097
|
+
explicitAccepted: evidence.explicitAccepted === true || app.accepted === true,
|
|
4098
|
+
terminal: /complete|closed|resolved|done|failed|rejected/i.test("".concat(job.status || '', " ").concat(job.phase || '')),
|
|
4099
|
+
now: input.now,
|
|
4100
|
+
metadata: {
|
|
4101
|
+
domain: app.domain || app.customDomain || job.domain,
|
|
4102
|
+
wowScore: (_g = evidence.wowScore) !== null && _g !== void 0 ? _g : job.wowScore,
|
|
4103
|
+
score: (_h = evidence.score) !== null && _h !== void 0 ? _h : evidence.qualityScore,
|
|
4104
|
+
costObservability: costObservabilityMetadata(costGate),
|
|
4105
|
+
hotfixDurability: hotfixDurabilityMetadata(gates),
|
|
4106
|
+
managerNoBlindLoopPolicy: managerNoBlindLoopMetadata(noBlindLoopGate),
|
|
4107
|
+
journeyContract: {
|
|
4108
|
+
status: journeyContractGate.status,
|
|
4109
|
+
valid: ((_j = journeyContractGate.metadata) === null || _j === void 0 ? void 0 : _j.valid) === true,
|
|
4110
|
+
path: cleanText((_k = journeyContractGate.metadata) === null || _k === void 0 ? void 0 : _k.path, 500),
|
|
4111
|
+
primaryWorkflowId: cleanText((_l = journeyContractGate.metadata) === null || _l === void 0 ? void 0 : _l.primaryWorkflowId, 200),
|
|
4112
|
+
workflowQaRowCount: Number(((_m = journeyContractGate.metadata) === null || _m === void 0 ? void 0 : _m.workflowQaRowCount) || 0),
|
|
4113
|
+
workflowQaCoverageTags: cleanStringList((_o = journeyContractGate.metadata) === null || _o === void 0 ? void 0 : _o.workflowQaCoverageTags, 80, 120),
|
|
4114
|
+
workflowQaProofKinds: cleanStringList((_p = journeyContractGate.metadata) === null || _p === void 0 ? void 0 : _p.workflowQaProofKinds, 80, 120),
|
|
4115
|
+
errorCount: Number(((_q = journeyContractGate.metadata) === null || _q === void 0 ? void 0 : _q.errorCount) || 0),
|
|
4116
|
+
warningCount: Number(((_r = journeyContractGate.metadata) === null || _r === void 0 ? void 0 : _r.warningCount) || 0),
|
|
4117
|
+
issueCodes: cleanStringList((_s = journeyContractGate.metadata) === null || _s === void 0 ? void 0 : _s.issueCodes, 40, 120),
|
|
4118
|
+
blocksBuildUntilValid: ((_t = journeyContractGate.metadata) === null || _t === void 0 ? void 0 : _t.blocksBuildUntilValid) === true,
|
|
4119
|
+
blocksWorkflowQaUntilValid: ((_u = journeyContractGate.metadata) === null || _u === void 0 ? void 0 : _u.blocksWorkflowQaUntilValid) === true,
|
|
4120
|
+
blocksWowUiUntilWorkflowProof: ((_v = journeyContractGate.metadata) === null || _v === void 0 ? void 0 : _v.blocksWowUiUntilWorkflowProof) === true,
|
|
4121
|
+
blocksPublishUntilWorkflowProof: ((_w = journeyContractGate.metadata) === null || _w === void 0 ? void 0 : _w.blocksPublishUntilWorkflowProof) === true,
|
|
4122
|
+
nextAction: cleanText((_x = journeyContractGate.metadata) === null || _x === void 0 ? void 0 : _x.nextAction, 1000)
|
|
4123
|
+
},
|
|
4124
|
+
workflowProofReadiness: {
|
|
4125
|
+
ready: workflowReadiness.ready,
|
|
4126
|
+
status: workflowReadiness.status,
|
|
4127
|
+
reason: workflowReadiness.reason,
|
|
4128
|
+
blockers: workflowReadiness.blockers,
|
|
4129
|
+
primaryWorkflowId: workflowReadiness.primaryWorkflowId,
|
|
4130
|
+
passedWorkflowRows: workflowReadiness.passedWorkflowRows,
|
|
4131
|
+
missingWorkflowRows: workflowReadiness.missingWorkflowRows,
|
|
4132
|
+
failedWorkflowRows: workflowReadiness.failedWorkflowRows,
|
|
4133
|
+
sampleDataReady: workflowReadiness.sampleDataReady,
|
|
4134
|
+
releaseBlockers: workflowReadiness.releaseBlockers,
|
|
4135
|
+
workflowProofFingerprint: workflowReadiness.workflowProofFingerprint,
|
|
4136
|
+
artifactFingerprint: workflowReadiness.artifactFingerprint,
|
|
4137
|
+
proofFreshness: workflowReadiness.proofFreshness
|
|
4138
|
+
},
|
|
4139
|
+
workflowProofCheckpoint: workflowProofCheckpointGate ? {
|
|
4140
|
+
status: cleanText((_y = workflowProofCheckpointGate.metadata) === null || _y === void 0 ? void 0 : _y.status, 120),
|
|
4141
|
+
gateStatus: workflowProofCheckpointGate.status,
|
|
4142
|
+
readinessStatus: cleanText((_z = workflowProofCheckpointGate.metadata) === null || _z === void 0 ? void 0 : _z.readinessStatus, 120),
|
|
4143
|
+
nextGate: cleanText((_0 = workflowProofCheckpointGate.metadata) === null || _0 === void 0 ? void 0 : _0.nextGate, 120),
|
|
4144
|
+
nextAction: cleanText((_1 = workflowProofCheckpointGate.metadata) === null || _1 === void 0 ? void 0 : _1.nextAction, 1000),
|
|
4145
|
+
blocksProductRepairUntilJourneyContract: ((_2 = workflowProofCheckpointGate.metadata) === null || _2 === void 0 ? void 0 : _2.blocksProductRepairUntilJourneyContract) === true,
|
|
4146
|
+
blocksPublishUntilWorkflowProof: ((_3 = workflowProofCheckpointGate.metadata) === null || _3 === void 0 ? void 0 : _3.blocksPublishUntilWorkflowProof) === true,
|
|
4147
|
+
blocksPublishUntilReleaseGate: ((_4 = workflowProofCheckpointGate.metadata) === null || _4 === void 0 ? void 0 : _4.blocksPublishUntilReleaseGate) === true,
|
|
4148
|
+
blocksWowUiUntilWorkflowProof: ((_5 = workflowProofCheckpointGate.metadata) === null || _5 === void 0 ? void 0 : _5.blocksWowUiUntilWorkflowProof) === true,
|
|
4149
|
+
workflowProofFingerprint: cleanText((_6 = workflowProofCheckpointGate.metadata) === null || _6 === void 0 ? void 0 : _6.workflowProofFingerprint, 200),
|
|
4150
|
+
artifactFingerprint: cleanText((_7 = workflowProofCheckpointGate.metadata) === null || _7 === void 0 ? void 0 : _7.artifactFingerprint, 200),
|
|
4151
|
+
blockers: cleanStringList((_8 = workflowProofCheckpointGate.metadata) === null || _8 === void 0 ? void 0 : _8.blockers, 20, 500)
|
|
4152
|
+
} : undefined,
|
|
4153
|
+
nextActionContract: nextActionContractGate ? {
|
|
4154
|
+
gateStatus: nextActionContractGate.status,
|
|
4155
|
+
contractId: cleanText((_9 = nextActionContractGate.metadata) === null || _9 === void 0 ? void 0 : _9.contractId, 200),
|
|
4156
|
+
action: cleanText((_10 = nextActionContractGate.metadata) === null || _10 === void 0 ? void 0 : _10.action, 120),
|
|
4157
|
+
label: cleanText((_11 = nextActionContractGate.metadata) === null || _11 === void 0 ? void 0 : _11.label, 200),
|
|
4158
|
+
primaryCommand: cleanText((_12 = nextActionContractGate.metadata) === null || _12 === void 0 ? void 0 : _12.primaryCommand, 200),
|
|
4159
|
+
lane: cleanText((_13 = nextActionContractGate.metadata) === null || _13 === void 0 ? void 0 : _13.lane, 120),
|
|
4160
|
+
stepType: cleanText((_14 = nextActionContractGate.metadata) === null || _14 === void 0 ? void 0 : _14.stepType, 120),
|
|
4161
|
+
safeToAutoRun: ((_15 = nextActionContractGate.metadata) === null || _15 === void 0 ? void 0 : _15.safeToAutoRun) === true,
|
|
4162
|
+
requiresHumanApproval: ((_16 = nextActionContractGate.metadata) === null || _16 === void 0 ? void 0 : _16.requiresHumanApproval) === true,
|
|
4163
|
+
canRunWithoutCodexMonitor: ((_17 = nextActionContractGate.metadata) === null || _17 === void 0 ? void 0 : _17.canRunWithoutCodexMonitor) === true,
|
|
4164
|
+
codexFallbackRequired: ((_18 = nextActionContractGate.metadata) === null || _18 === void 0 ? void 0 : _18.codexFallbackRequired) === true,
|
|
4165
|
+
costRisk: cleanText((_19 = nextActionContractGate.metadata) === null || _19 === void 0 ? void 0 : _19.costRisk, 120),
|
|
4166
|
+
workflowFirstSatisfied: ((_20 = nextActionContractGate.metadata) === null || _20 === void 0 ? void 0 : _20.workflowFirstSatisfied) === true,
|
|
4167
|
+
hotfixCommitRequired: ((_21 = nextActionContractGate.metadata) === null || _21 === void 0 ? void 0 : _21.hotfixCommitRequired) === true,
|
|
4168
|
+
liveHotfixBlockedUntilCommit: ((_22 = nextActionContractGate.metadata) === null || _22 === void 0 ? void 0 : _22.liveHotfixBlockedUntilCommit) === true,
|
|
4169
|
+
decisionBasis: plainObject((_23 = nextActionContractGate.metadata) === null || _23 === void 0 ? void 0 : _23.decisionBasis),
|
|
4170
|
+
preconditions: cleanStringList((_24 = nextActionContractGate.metadata) === null || _24 === void 0 ? void 0 : _24.preconditions, 20, 500),
|
|
4171
|
+
successEvidence: cleanStringList((_25 = nextActionContractGate.metadata) === null || _25 === void 0 ? void 0 : _25.successEvidence, 20, 500),
|
|
4172
|
+
requiredHotfixCommitProof: cleanStringList((_26 = nextActionContractGate.metadata) === null || _26 === void 0 ? void 0 : _26.requiredHotfixCommitProof, 20, 240),
|
|
4173
|
+
stopConditions: cleanStringList((_27 = nextActionContractGate.metadata) === null || _27 === void 0 ? void 0 : _27.stopConditions, 20, 500),
|
|
4174
|
+
forbiddenActions: cleanStringList((_28 = nextActionContractGate.metadata) === null || _28 === void 0 ? void 0 : _28.forbiddenActions, 20, 500),
|
|
4175
|
+
nextCommands: cleanStringList((_29 = nextActionContractGate.metadata) === null || _29 === void 0 ? void 0 : _29.nextCommands, 20, 240),
|
|
4176
|
+
blockers: cleanStringList((_30 = nextActionContractGate.metadata) === null || _30 === void 0 ? void 0 : _30.blockers, 20, 500)
|
|
4177
|
+
} : undefined
|
|
4178
|
+
}
|
|
4179
|
+
});
|
|
4180
|
+
}
|
|
4181
|
+
function buildAssistantAIRunFromEvidence(input) {
|
|
4182
|
+
var e_35, _a, e_36, _b, e_37, _c;
|
|
4183
|
+
var _d, _e, _f, _g;
|
|
4184
|
+
var conversation = input.conversation || {};
|
|
4185
|
+
var events = [];
|
|
4186
|
+
var sourceIds = {};
|
|
4187
|
+
addSourceId(sourceIds, 'runId', input.runId);
|
|
4188
|
+
addSourceId(sourceIds, 'requestId', input.requestId);
|
|
4189
|
+
addSourceId(sourceIds, 'messageId', input.messageId);
|
|
4190
|
+
addSourceId(sourceIds, 'conversationId', conversation._id || conversation.id || conversation.conversationId);
|
|
4191
|
+
addSourceId(sourceIds, 'userId', conversation.userId || conversation.ownerId);
|
|
4192
|
+
try {
|
|
4193
|
+
for (var _h = __values(asArray(input.messages)), _j = _h.next(); !_j.done; _j = _h.next()) {
|
|
4194
|
+
var message = _j.value;
|
|
4195
|
+
pushEvent(events, {
|
|
4196
|
+
type: 'assistant_message',
|
|
4197
|
+
category: cleanText(message.role || message.authorRole || message.type, 160),
|
|
4198
|
+
message: cleanText(message.content || message.text || message.message || message.summary, 1800),
|
|
4199
|
+
recordedAt: eventDate(message),
|
|
4200
|
+
metadata: {
|
|
4201
|
+
id: message._id || message.id,
|
|
4202
|
+
role: message.role,
|
|
4203
|
+
model: message.model || ((_d = message === null || message === void 0 ? void 0 : message.usage) === null || _d === void 0 ? void 0 : _d.model)
|
|
4204
|
+
}
|
|
4205
|
+
});
|
|
4206
|
+
}
|
|
4207
|
+
}
|
|
4208
|
+
catch (e_35_1) { e_35 = { error: e_35_1 }; }
|
|
4209
|
+
finally {
|
|
4210
|
+
try {
|
|
4211
|
+
if (_j && !_j.done && (_a = _h.return)) _a.call(_h);
|
|
4212
|
+
}
|
|
4213
|
+
finally { if (e_35) throw e_35.error; }
|
|
4214
|
+
}
|
|
4215
|
+
try {
|
|
4216
|
+
for (var _k = __values(asArray(input.issueReports)), _l = _k.next(); !_l.done; _l = _k.next()) {
|
|
4217
|
+
var report = _l.value;
|
|
4218
|
+
pushEvent(events, {
|
|
4219
|
+
type: 'human_intervention',
|
|
4220
|
+
category: cleanText(report.category || report.status || 'issue_report', 160),
|
|
4221
|
+
message: cleanText(report.summary || report.description || report.message || report.title, 1800),
|
|
4222
|
+
recordedAt: eventDate(report),
|
|
4223
|
+
metadata: {
|
|
4224
|
+
id: report._id || report.id,
|
|
4225
|
+
status: report.status,
|
|
4226
|
+
severity: report.severity
|
|
4227
|
+
}
|
|
4228
|
+
});
|
|
4229
|
+
}
|
|
4230
|
+
}
|
|
4231
|
+
catch (e_36_1) { e_36 = { error: e_36_1 }; }
|
|
4232
|
+
finally {
|
|
4233
|
+
try {
|
|
4234
|
+
if (_l && !_l.done && (_b = _k.return)) _b.call(_k);
|
|
4235
|
+
}
|
|
4236
|
+
finally { if (e_36) throw e_36.error; }
|
|
4237
|
+
}
|
|
4238
|
+
var cost = collectUsageEvents(asArray(input.usageLedger), events);
|
|
4239
|
+
var costGate = costObservabilityGate(cost, 'ai_assistant', input.now);
|
|
4240
|
+
pushEvent(events, {
|
|
4241
|
+
type: 'usage',
|
|
4242
|
+
category: 'cost_observability',
|
|
4243
|
+
message: costGate.reason,
|
|
4244
|
+
artifactPaths: costGate.evidenceRefs,
|
|
4245
|
+
recordedAt: costGate.recordedAt,
|
|
4246
|
+
metadata: costGate.metadata
|
|
4247
|
+
});
|
|
4248
|
+
var answerQuality = assistantQualityObject(input);
|
|
4249
|
+
try {
|
|
4250
|
+
for (var _m = __values(assistantQueryExecutions(answerQuality).slice(0, 40)), _o = _m.next(); !_o.done; _o = _m.next()) {
|
|
4251
|
+
var execution = _o.value;
|
|
4252
|
+
var status_1 = cleanText(execution.status || execution.queryStatus || execution.query_status || execution.resultStatus || execution.result_status, 120);
|
|
4253
|
+
var toolName = cleanText(execution.tool || execution.toolName || execution.tool_name || execution.type || 'query', 160);
|
|
4254
|
+
var collection = cleanText(execution.collection || execution.collectionName || execution.collection_name, 240);
|
|
4255
|
+
pushEvent(events, {
|
|
4256
|
+
type: 'assistant_query',
|
|
4257
|
+
category: status_1 || toolName,
|
|
4258
|
+
message: cleanText(execution.summary || execution.message || "".concat(toolName).concat(collection ? " ".concat(collection) : ''), 1200),
|
|
4259
|
+
artifactPaths: cleanStringList(__spreadArray(__spreadArray([
|
|
4260
|
+
execution.artifactPath,
|
|
4261
|
+
execution.artifact_path,
|
|
4262
|
+
execution.path
|
|
4263
|
+
], __read(asArray(execution.artifactPaths)), false), __read(asArray(execution.artifact_paths)), false), 20, 500),
|
|
4264
|
+
recordedAt: eventDate(execution),
|
|
4265
|
+
metadata: {
|
|
4266
|
+
id: execution.id || execution._id || execution.ref,
|
|
4267
|
+
tool: toolName,
|
|
4268
|
+
status: status_1,
|
|
4269
|
+
collection: collection,
|
|
4270
|
+
resultCount: (_f = (_e = execution.resultCount) !== null && _e !== void 0 ? _e : execution.result_count) !== null && _f !== void 0 ? _f : execution.count,
|
|
4271
|
+
queryStatus: execution.queryStatus || execution.query_status,
|
|
4272
|
+
legalQueryShape: (_g = execution.legalQueryShape) !== null && _g !== void 0 ? _g : execution.legal_query_shape
|
|
4273
|
+
}
|
|
4274
|
+
});
|
|
4275
|
+
}
|
|
4276
|
+
}
|
|
4277
|
+
catch (e_37_1) { e_37 = { error: e_37_1 }; }
|
|
4278
|
+
finally {
|
|
4279
|
+
try {
|
|
4280
|
+
if (_o && !_o.done && (_c = _m.return)) _c.call(_m);
|
|
4281
|
+
}
|
|
4282
|
+
finally { if (e_37) throw e_37.error; }
|
|
4283
|
+
}
|
|
4284
|
+
var answerQualityDecision = evaluateAssistantAnswerQuality({
|
|
4285
|
+
answerQuality: answerQuality,
|
|
4286
|
+
correctnessChecks: input.correctnessChecks,
|
|
4287
|
+
now: input.now
|
|
4288
|
+
});
|
|
4289
|
+
var answerQualityGate = assistantAnswerQualityGate(answerQualityDecision, input.now);
|
|
4290
|
+
pushEvent(events, {
|
|
4291
|
+
type: 'assistant_message',
|
|
4292
|
+
category: 'assistant_answer_quality',
|
|
4293
|
+
message: answerQualityGate.reason,
|
|
4294
|
+
artifactPaths: answerQualityGate.evidenceRefs,
|
|
4295
|
+
recordedAt: answerQualityGate.recordedAt,
|
|
4296
|
+
metadata: answerQualityGate.metadata
|
|
4297
|
+
});
|
|
4298
|
+
var answerActionabilityContract = buildAssistantAnswerActionabilityContract(answerQualityDecision, input.now);
|
|
4299
|
+
var answerActionabilityGate = assistantAnswerActionabilityGate(answerActionabilityContract, input.now);
|
|
4300
|
+
pushEvent(events, {
|
|
4301
|
+
type: 'assistant_message',
|
|
4302
|
+
category: 'assistant_answer_actionability',
|
|
4303
|
+
message: answerActionabilityGate.reason,
|
|
4304
|
+
artifactPaths: answerActionabilityGate.evidenceRefs,
|
|
4305
|
+
recordedAt: answerActionabilityGate.recordedAt,
|
|
4306
|
+
metadata: answerActionabilityGate.metadata
|
|
4307
|
+
});
|
|
4308
|
+
var correctnessChecks = asArray(input.correctnessChecks);
|
|
4309
|
+
var hasPassedCorrectnessCheck = correctnessChecks.some(function (check) { return /^(pass|passed|success|ok)$/i.test(cleanText(check.status || (check.passed === true ? 'pass' : ''), 80)); });
|
|
4310
|
+
var correctnessEvidence = {
|
|
4311
|
+
businessAssertions: __spreadArray(__spreadArray([], __read(correctnessChecks.map(function (check) { return ({
|
|
4312
|
+
assertion: check.assertion || check.name || check.case || 'assistant correctness check',
|
|
4313
|
+
status: check.status || statusFromBoolean(check.passed),
|
|
4314
|
+
expected: check.expected,
|
|
4315
|
+
observed: check.observed || check.actual,
|
|
4316
|
+
dataProof: check.dataProof || check.proof,
|
|
4317
|
+
artifactPaths: check.artifactPaths,
|
|
4318
|
+
message: check.message || check.reason,
|
|
4319
|
+
metadata: check.metadata,
|
|
4320
|
+
recordedAt: eventDate(check)
|
|
4321
|
+
}); })), false), __read((answerQualityDecision.ready && !hasPassedCorrectnessCheck ? [{
|
|
4322
|
+
assertion: 'Assistant answer quality gate passed.',
|
|
4323
|
+
status: 'pass',
|
|
4324
|
+
expected: 'Correct dates, legal query shape, query result classification, cited evidence, confidence, and next action.',
|
|
4325
|
+
observed: answerQualityDecision.reason,
|
|
4326
|
+
dataProof: answerQualityDecision.evidenceRefs.concat(answerQualityDecision.citationRefs).join(', '),
|
|
4327
|
+
artifactPaths: answerQualityDecision.evidenceRefs,
|
|
4328
|
+
message: answerQualityDecision.reason,
|
|
4329
|
+
metadata: {
|
|
4330
|
+
answerQualityStatus: answerQualityDecision.status,
|
|
4331
|
+
queryStatus: answerQualityDecision.queryStatus,
|
|
4332
|
+
dateWindowRequired: answerQualityDecision.dateWindowRequired,
|
|
4333
|
+
dateWindowPresent: answerQualityDecision.dateWindowPresent,
|
|
4334
|
+
dateWindow: answerQualityDecision.dateWindow
|
|
4335
|
+
}
|
|
4336
|
+
}] : [])), false)
|
|
4337
|
+
};
|
|
4338
|
+
var qa = applyAssistantAnswerQualityGate(buildQaFromEvidence(correctnessEvidence, input.now), answerQualityDecision, input.now);
|
|
4339
|
+
var failedReports = asArray(input.issueReports)
|
|
4340
|
+
.filter(function (report) { return /open|new|fail|bug|wrong|incorrect|error/i.test("".concat(report.status || '', " ").concat(report.category || '', " ").concat(report.summary || '')); });
|
|
4341
|
+
return (0, ai_run_evidence_1.buildAIRun)({
|
|
4342
|
+
id: cleanText(input.runId, 240) || undefined,
|
|
4343
|
+
source: 'ai_assistant',
|
|
4344
|
+
sourceIds: sourceIds,
|
|
4345
|
+
title: firstText(conversation, ['title', 'subject', 'summary']) || 'AI assistant conversation',
|
|
4346
|
+
status: firstText(conversation, ['status', 'state']),
|
|
4347
|
+
phase: firstText(conversation, ['phase']),
|
|
4348
|
+
startedAt: dateValue(conversation, ['startedAt', 'createdAt']),
|
|
4349
|
+
completedAt: dateValue(conversation, ['completedAt', 'closedAt', 'updatedAt']),
|
|
4350
|
+
events: events,
|
|
4351
|
+
gates: [answerActionabilityGate, costGate],
|
|
4352
|
+
qa: qa,
|
|
4353
|
+
cost: cost,
|
|
4354
|
+
rejected: failedReports.length > 0 || conversation.rejected === true,
|
|
4355
|
+
manualHandoff: conversation.manualHandoff === true,
|
|
4356
|
+
stopped: conversation.stopped === true,
|
|
4357
|
+
explicitAccepted: conversation.accepted === true,
|
|
4358
|
+
terminal: /complete|closed|resolved|done|failed|rejected/i.test("".concat(conversation.status || '')),
|
|
4359
|
+
now: input.now,
|
|
4360
|
+
metadata: {
|
|
4361
|
+
issueReportCount: asArray(input.issueReports).length,
|
|
4362
|
+
correctnessCheckCount: correctnessChecks.length,
|
|
4363
|
+
costObservability: costObservabilityMetadata(costGate),
|
|
4364
|
+
answerQuality: {
|
|
4365
|
+
ready: answerQualityDecision.ready,
|
|
4366
|
+
status: answerQualityDecision.status,
|
|
4367
|
+
queryStatus: answerQualityDecision.queryStatus,
|
|
4368
|
+
confidenceLevel: answerQualityDecision.confidenceLevel,
|
|
4369
|
+
dateBasis: answerQualityDecision.dateBasis,
|
|
4370
|
+
expectedCurrentDate: answerQualityDecision.expectedCurrentDate,
|
|
4371
|
+
dateWindowRequired: answerQualityDecision.dateWindowRequired,
|
|
4372
|
+
dateWindowPresent: answerQualityDecision.dateWindowPresent,
|
|
4373
|
+
dateWindow: answerQualityDecision.dateWindow,
|
|
4374
|
+
noDataConfirmed: answerQualityDecision.noDataConfirmed,
|
|
4375
|
+
legalQueryShape: answerQualityDecision.legalQueryShape,
|
|
4376
|
+
citationRefs: answerQualityDecision.citationRefs,
|
|
4377
|
+
queryEvidenceRequired: answerQualityDecision.queryEvidenceRequired,
|
|
4378
|
+
queryEvidencePresent: answerQualityDecision.queryEvidencePresent,
|
|
4379
|
+
queryEvidenceRefs: answerQualityDecision.queryEvidenceRefs,
|
|
4380
|
+
queryExecutionCount: answerQualityDecision.queryExecutionCount,
|
|
4381
|
+
nextActions: answerQualityDecision.nextActions,
|
|
4382
|
+
blockers: answerQualityDecision.blockers
|
|
4383
|
+
},
|
|
4384
|
+
answerActionability: {
|
|
4385
|
+
contractId: answerActionabilityContract.contractId,
|
|
4386
|
+
status: answerActionabilityContract.status,
|
|
4387
|
+
primaryCommand: answerActionabilityContract.primaryCommand,
|
|
4388
|
+
label: answerActionabilityContract.label,
|
|
4389
|
+
canAnswerCustomer: answerActionabilityContract.canAnswerCustomer,
|
|
4390
|
+
canDraftSupportReply: answerActionabilityContract.canDraftSupportReply,
|
|
4391
|
+
canSendCustomerReply: answerActionabilityContract.canSendCustomerReply,
|
|
4392
|
+
requiresHumanReview: answerActionabilityContract.requiresHumanReview,
|
|
4393
|
+
canRunWithoutCodexMonitor: answerActionabilityContract.canRunWithoutCodexMonitor,
|
|
4394
|
+
codexFallbackRequired: answerActionabilityContract.codexFallbackRequired,
|
|
4395
|
+
costRisk: answerActionabilityContract.costRisk,
|
|
4396
|
+
queryResultClass: answerActionabilityContract.queryResultClass,
|
|
4397
|
+
confidenceLevel: answerActionabilityContract.confidenceLevel,
|
|
4398
|
+
decisionBasis: answerActionabilityContract.decisionBasis,
|
|
4399
|
+
requiredEvidence: answerActionabilityContract.requiredEvidence,
|
|
4400
|
+
successEvidence: answerActionabilityContract.successEvidence,
|
|
4401
|
+
blockers: answerActionabilityContract.blockers,
|
|
4402
|
+
nextActions: answerActionabilityContract.nextActions,
|
|
4403
|
+
nextCommands: answerActionabilityContract.nextCommands,
|
|
4404
|
+
forbiddenActions: answerActionabilityContract.forbiddenActions
|
|
4405
|
+
}
|
|
4406
|
+
}
|
|
4407
|
+
});
|
|
4408
|
+
}
|
|
4409
|
+
|
|
4410
|
+
//# sourceMappingURL=ai-run-evidence-adapters.js.map
|