@resolveio/server-lib 22.3.174 → 22.3.176
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/.nodemon.json +5 -0
- package/.vscode/settings.json +21 -0
- package/AGENTS.md +195 -0
- package/README.md +22 -0
- package/build_package.sh +5 -0
- package/compileDTS.pl +64 -0
- package/docs/ai-assistant-nightly-eval.md +65 -0
- package/docs/ai-assistant-preflight-checklist.md +23 -0
- package/docs/ai-assistant-report-builder-bridge-playbook.md +115 -0
- package/eslint-plugin-custom/index.js +7 -0
- package/eslint-plugin-custom/rules/no-filter-zero-index.js +44 -0
- package/eslint.config.js +103 -0
- package/gulpfile.js +216 -0
- package/methodAndPublicationListGenerator.py +375 -0
- package/mongodbensurers.js +2 -0
- package/mongostop.js +3 -0
- package/package.json +1 -1
- package/scripts/cleanup-bypassed-callmethod-logs.js +616 -0
- package/settings.development.json +25 -0
- package/settings.development.redacted.json +25 -0
- package/src/.env +12 -0
- package/src/ai/assistant-core-heuristics.ts +379 -0
- package/src/ai/resolveio-platform-intelligence-memory-corpus.ts +185 -0
- package/src/ai/resolveio-platform-intelligence-memory.ts +325 -0
- package/{ai/resolveio-platform-intelligence-types.d.ts → src/ai/resolveio-platform-intelligence-types.ts} +20 -15
- package/src/ai/resolveio-platform-intelligence.ts +462 -0
- package/src/client-server-app.ts +12 -0
- package/src/collections/ai-run.collection.ts +117 -0
- package/src/collections/ai-terminal-conversation.collection.ts +91 -0
- package/src/collections/ai-terminal-issue-report.collection.ts +99 -0
- package/src/collections/ai-terminal-message.collection.ts +77 -0
- package/src/collections/app-setting.collection.ts +104 -0
- package/src/collections/app-status.collection.ts +58 -0
- package/src/collections/communication-metric.collection.ts +84 -0
- package/src/collections/counter.collection.ts +56 -0
- package/src/collections/cron-job-history.collection.ts +94 -0
- package/src/collections/cron-job.collection.ts +92 -0
- package/src/collections/customer-notification.collection.ts +131 -0
- package/src/collections/customer-portal-password.collection.ts +76 -0
- package/src/collections/email-history.collection.ts +134 -0
- package/src/collections/email-verified.collection.ts +62 -0
- package/src/collections/file.collection.ts +74 -0
- package/src/collections/flag-update.collection.ts +57 -0
- package/src/collections/flag.collection.ts +57 -0
- package/src/collections/log-method-latency.collection.ts +77 -0
- package/src/collections/log-subscription.collection.ts +80 -0
- package/src/collections/log.collection.ts +93 -0
- package/src/collections/logged-in-users.collection.ts +67 -0
- package/src/collections/monitor-cpu.collection.ts +65 -0
- package/src/collections/monitor-function.collection.ts +74 -0
- package/src/collections/monitor-memory.collection.ts +77 -0
- package/src/collections/monitor-mongo.collection.ts +71 -0
- package/src/collections/notification.collection.ts +57 -0
- package/src/collections/openai-usage-ledger.collection.ts +131 -0
- package/src/collections/report-builder-dashboard-builder.collection.ts +109 -0
- package/src/collections/report-builder-library.collection.ts +89 -0
- package/src/collections/report-builder-report.collection.ts +184 -0
- package/src/collections/user-group.collection.ts +89 -0
- package/src/collections/user-guide.collection.ts +57 -0
- package/src/collections/user.collection.ts +181 -0
- package/src/cron/cron.ts +117 -0
- package/src/fixtures/cron-jobs.ts +95 -0
- package/src/fixtures/init.ts +35 -0
- package/src/http/auth.ts +818 -0
- package/src/http/health.ts +7 -0
- package/src/http/home.ts +90 -0
- package/src/http/slow-query-publication.ts +49 -0
- package/src/index.ts +1 -0
- package/src/managers/ai-assistant-codex-manager.manager.ts +1131 -0
- package/src/managers/ai-run-evidence.manager.ts +264 -0
- package/src/managers/communication-metric.manager.ts +82 -0
- package/src/managers/cron.manager.ts +333 -0
- package/src/managers/customer-notification-content.manager.ts +236 -0
- package/src/managers/diagnostic-manager-bootstrap.ts +165 -0
- package/src/managers/error-auto-fix.manager.ts +2767 -0
- package/src/managers/local-log.manager.ts +113 -0
- package/src/managers/method.manager.ts +1857 -0
- package/src/managers/mongo.manager.ts +4575 -0
- package/src/managers/monitor.manager.ts +507 -0
- package/src/managers/openai-usage-ledger.manager.ts +112 -0
- package/src/managers/slow-query-verifier.manager.ts +3590 -0
- package/src/managers/slow-query.manager.ts +519 -0
- package/src/managers/subscription.manager.ts +3128 -0
- package/src/managers/websocket.manager.ts +746 -0
- package/src/managers/worker-dispatcher.manager.ts +1360 -0
- package/src/managers/worker-server.manager.ts +536 -0
- package/src/methods/accounts.ts +532 -0
- package/src/methods/ai-terminal.ts +23825 -0
- package/src/methods/app-settings.ts +114 -0
- package/src/methods/aws.ts +649 -0
- package/src/methods/collections.ts +641 -0
- package/src/methods/counters.ts +69 -0
- package/src/methods/cron-jobs.ts +2614 -0
- package/src/methods/customer-notifications.ts +458 -0
- package/src/methods/diagnostics.ts +616 -0
- package/src/methods/flag-updates.ts +7 -0
- package/src/methods/flags.ts +7 -0
- package/src/methods/logs.ts +657 -0
- package/src/methods/mongo-explorer.ts +1880 -0
- package/src/methods/monitor.ts +540 -0
- package/src/methods/pdf.ts +1236 -0
- package/src/methods/publications.ts +129 -0
- package/src/methods/report-builder.ts +3300 -0
- package/src/methods/support.ts +335 -0
- package/src/models/ai-run.model.ts +27 -0
- package/src/models/ai-terminal-conversation.model.ts +19 -0
- package/src/models/ai-terminal-issue-report.model.ts +21 -0
- package/src/models/ai-terminal-message.model.ts +24 -0
- package/src/models/app-setting.model.ts +17 -0
- package/{models/app-status.model.d.ts → src/models/app-status.model.ts} +3 -2
- package/{models/billing-logged-in-users.model.d.ts → src/models/billing-logged-in-users.model.ts} +5 -4
- package/src/models/collection-document.model.ts +24 -0
- package/src/models/communication-metric.model.ts +23 -0
- package/{models/counter.model.d.ts → src/models/counter.model.ts} +4 -3
- package/src/models/cron-job-history.model.ts +16 -0
- package/src/models/cron-job.model.ts +15 -0
- package/src/models/customer-notification.model.ts +28 -0
- package/src/models/customer-portal-password.model.ts +12 -0
- package/src/models/dialog.model.ts +25 -0
- package/{models/email-history.model.js → src/models/email-history.model.ts} +36 -4
- package/{models/email-verified.model.d.ts → src/models/email-verified.model.ts} +6 -5
- package/{models/file.model.d.ts → src/models/file.model.ts} +8 -7
- package/{models/flag-update.model.d.ts → src/models/flag-update.model.ts} +4 -3
- package/{models/flag.model.d.ts → src/models/flag.model.ts} +4 -3
- package/src/models/log-method-latency.model.ts +11 -0
- package/{models/log-subscription.model.d.ts → src/models/log-subscription.model.ts} +11 -9
- package/src/models/log.model.ts +19 -0
- package/{models/logged-in-users.model.d.ts → src/models/logged-in-users.model.ts} +6 -5
- package/{models/method-response.model.d.ts → src/models/method-response.model.ts} +7 -6
- package/src/models/method.model.ts +25 -0
- package/{models/monitor-cpu.model.d.ts → src/models/monitor-cpu.model.ts} +9 -7
- package/src/models/monitor-function.model.ts +16 -0
- package/src/models/monitor-memory.model.ts +17 -0
- package/src/models/monitor-mongo.model.ts +15 -0
- package/{models/notification.model.d.ts → src/models/notification.model.ts} +6 -4
- package/src/models/openai-usage-ledger.model.ts +56 -0
- package/src/models/pagination.model.ts +35 -0
- package/src/models/permission.model.ts +14 -0
- package/src/models/report-builder-dashboard-builder.model.ts +29 -0
- package/src/models/report-builder-library.model.ts +20 -0
- package/src/models/report-builder-report.model.ts +136 -0
- package/src/models/report-builder.model.ts +68 -0
- package/src/models/select-data-label.model.ts +9 -0
- package/src/models/server-message.model.ts +31 -0
- package/src/models/slow-query-report.model.ts +23 -0
- package/src/models/subscription.model.ts +73 -0
- package/src/models/support-ticket.model.ts +104 -0
- package/src/models/user-group.model.ts +24 -0
- package/{models/user-guide.model.d.ts → src/models/user-guide.model.ts} +5 -4
- package/src/models/user.model.ts +96 -0
- package/src/private/images/ResolveIO.png +0 -0
- package/src/publications/ai-terminal.ts +73 -0
- package/src/publications/app-settings.ts +25 -0
- package/src/publications/app-status.ts +13 -0
- package/src/publications/cron-jobs.ts +40 -0
- package/src/publications/customer-notifications.ts +101 -0
- package/src/publications/files.ts +33 -0
- package/src/publications/flags-update.ts +19 -0
- package/src/publications/flags.ts +19 -0
- package/src/publications/logs.ts +163 -0
- package/src/publications/notifications.ts +13 -0
- package/src/publications/report-builder-dashboard-builders.ts +39 -0
- package/src/publications/report-builder-libraries.ts +41 -0
- package/src/publications/report-builder-reports.ts +47 -0
- package/src/publications/super-admin.ts +13 -0
- package/src/publications/user-groups.ts +12 -0
- package/src/publications/user-guides.ts +12 -0
- package/src/resolveio-server-app.ts +617 -0
- package/src/server-app.ts +3354 -0
- package/src/services/codex-client.ts +1231 -0
- package/src/services/openai-client.ts +265 -0
- package/src/types/error-report.ts +26 -0
- package/src/types/js-tiktoken.d.ts +11 -0
- package/src/types/slow-query-report.ts +28 -0
- package/src/util/ai-qa-policy.ts +925 -0
- package/src/util/ai-run-evidence-adapters.ts +3292 -0
- package/src/util/ai-run-evidence-dashboard.ts +313 -0
- package/src/util/ai-run-evidence-eval.ts +1054 -0
- package/src/util/ai-run-evidence.ts +1124 -0
- package/src/util/ai-runner-artifacts.ts +586 -0
- package/src/util/ai-runner-manager-autopilot.ts +961 -0
- package/src/util/ai-runner-manager-policy.ts +4193 -0
- package/src/util/ai-runner-qa-auth.ts +821 -0
- package/src/util/ai-runner-qa-tools.ts +3045 -0
- package/src/util/aicoder-runner-v6.ts +2510 -0
- package/src/util/common.ts +649 -0
- package/src/util/customer-portal-password.ts +183 -0
- package/src/util/error-reporter.ts +332 -0
- package/src/util/error-tracking.ts +79 -0
- package/src/util/openai-usage-cost.ts +114 -0
- package/src/util/report-builder-unwinds.ts +180 -0
- package/src/util/runner-process-janitor.ts +219 -0
- package/src/util/schema-report-builder.ts +448 -0
- package/src/util/slow-query-reporter.ts +216 -0
- package/src/util/subscription-dependency-context.ts +1096 -0
- package/src/util/support-runner-v5.ts +4785 -0
- package/src/util/tokenizer.ts +38 -0
- package/src/workers/codex-runner.worker.ts +142 -0
- package/start_server.sh +5 -0
- package/tests/ai-assistant-corpus-build.ts +484 -0
- package/tests/ai-assistant-corpus-replay-e2e.ts +774 -0
- package/tests/ai-assistant-data-parity-e2e.ts +1989 -0
- package/tests/ai-assistant-eval-triage.ts +831 -0
- package/tests/ai-assistant-openai-e2e.ts +1061 -0
- package/tests/ai-assistant-openai-git-e2e.ts +155 -0
- package/tests/ai-assistant-preflight-matrix.ts +215 -0
- package/tests/ai-assistant-routing-eval.test.ts +560 -0
- package/tests/ai-assistant-snf-live-eval.ts +975 -0
- package/tests/ai-assistant-utils.test.ts +3057 -0
- package/tests/ai-manager-autopilot-snapshot.test.ts +193 -0
- package/tests/ai-manager-recovery-checkpoint.test.ts +1136 -0
- package/tests/ai-run-eval.test.ts +112 -0
- package/tests/ai-run-evidence.test.ts +1403 -0
- package/tests/ai-runner-contract.test.ts +488 -0
- package/tests/aicoder-runner-v6.test.ts +676 -0
- package/tests/error-reporter.test.ts +145 -0
- package/tests/method-publication-generator.test.ts +46 -0
- package/tests/report-builder-linking.test.ts +79 -0
- package/tests/resolveio-platform-intelligence.test.ts +352 -0
- package/tests/server-app-cron-owner.test.ts +127 -0
- package/tests/subscription-connect-race.test.ts +158 -0
- package/tests/subscription-dependency-context.test.ts +324 -0
- package/tests/subscription-manager-collection-tracking.test.ts +86 -0
- package/tests/subscription-manager-invalidation.test.ts +86 -0
- package/tests/support-runner-v5.test.ts +1166 -0
- package/tsconfig.json +34 -0
- package/ai/assistant-core-heuristics.d.ts +0 -11
- package/ai/assistant-core-heuristics.js +0 -356
- package/ai/assistant-core-heuristics.js.map +0 -1
- package/ai/resolveio-platform-intelligence-memory-corpus.d.ts +0 -3
- package/ai/resolveio-platform-intelligence-memory-corpus.js +0 -214
- package/ai/resolveio-platform-intelligence-memory-corpus.js.map +0 -1
- package/ai/resolveio-platform-intelligence-memory.d.ts +0 -20
- package/ai/resolveio-platform-intelligence-memory.js +0 -341
- package/ai/resolveio-platform-intelligence-memory.js.map +0 -1
- package/ai/resolveio-platform-intelligence-types.js +0 -4
- package/ai/resolveio-platform-intelligence-types.js.map +0 -1
- package/ai/resolveio-platform-intelligence.d.ts +0 -6
- package/ai/resolveio-platform-intelligence.js +0 -463
- package/ai/resolveio-platform-intelligence.js.map +0 -1
- package/client-server-app.d.ts +0 -1
- package/client-server-app.js +0 -68
- package/client-server-app.js.map +0 -1
- package/collections/ai-run.collection.d.ts +0 -3
- package/collections/ai-run.collection.js +0 -170
- package/collections/ai-run.collection.js.map +0 -1
- package/collections/ai-terminal-conversation.collection.d.ts +0 -2
- package/collections/ai-terminal-conversation.collection.js +0 -140
- package/collections/ai-terminal-conversation.collection.js.map +0 -1
- package/collections/ai-terminal-issue-report.collection.d.ts +0 -2
- package/collections/ai-terminal-issue-report.collection.js +0 -148
- package/collections/ai-terminal-issue-report.collection.js.map +0 -1
- package/collections/ai-terminal-message.collection.d.ts +0 -2
- package/collections/ai-terminal-message.collection.js +0 -121
- package/collections/ai-terminal-message.collection.js.map +0 -1
- package/collections/app-setting.collection.d.ts +0 -3
- package/collections/app-setting.collection.js +0 -103
- package/collections/app-setting.collection.js.map +0 -1
- package/collections/app-status.collection.d.ts +0 -3
- package/collections/app-status.collection.js +0 -57
- package/collections/app-status.collection.js.map +0 -1
- package/collections/communication-metric.collection.d.ts +0 -2
- package/collections/communication-metric.collection.js +0 -133
- package/collections/communication-metric.collection.js.map +0 -1
- package/collections/counter.collection.d.ts +0 -3
- package/collections/counter.collection.js +0 -56
- package/collections/counter.collection.js.map +0 -1
- package/collections/cron-job-history.collection.d.ts +0 -3
- package/collections/cron-job-history.collection.js +0 -137
- package/collections/cron-job-history.collection.js.map +0 -1
- package/collections/cron-job.collection.d.ts +0 -3
- package/collections/cron-job.collection.js +0 -92
- package/collections/cron-job.collection.js.map +0 -1
- package/collections/customer-notification.collection.d.ts +0 -3
- package/collections/customer-notification.collection.js +0 -130
- package/collections/customer-notification.collection.js.map +0 -1
- package/collections/customer-portal-password.collection.d.ts +0 -3
- package/collections/customer-portal-password.collection.js +0 -75
- package/collections/customer-portal-password.collection.js.map +0 -1
- package/collections/email-history.collection.d.ts +0 -3
- package/collections/email-history.collection.js +0 -134
- package/collections/email-history.collection.js.map +0 -1
- package/collections/email-verified.collection.d.ts +0 -3
- package/collections/email-verified.collection.js +0 -62
- package/collections/email-verified.collection.js.map +0 -1
- package/collections/file.collection.d.ts +0 -3
- package/collections/file.collection.js +0 -74
- package/collections/file.collection.js.map +0 -1
- package/collections/flag-update.collection.d.ts +0 -3
- package/collections/flag-update.collection.js +0 -57
- package/collections/flag-update.collection.js.map +0 -1
- package/collections/flag.collection.d.ts +0 -3
- package/collections/flag.collection.js +0 -57
- package/collections/flag.collection.js.map +0 -1
- package/collections/log-method-latency.collection.d.ts +0 -3
- package/collections/log-method-latency.collection.js +0 -77
- package/collections/log-method-latency.collection.js.map +0 -1
- package/collections/log-subscription.collection.d.ts +0 -3
- package/collections/log-subscription.collection.js +0 -80
- package/collections/log-subscription.collection.js.map +0 -1
- package/collections/log.collection.d.ts +0 -3
- package/collections/log.collection.js +0 -93
- package/collections/log.collection.js.map +0 -1
- package/collections/logged-in-users.collection.d.ts +0 -3
- package/collections/logged-in-users.collection.js +0 -67
- package/collections/logged-in-users.collection.js.map +0 -1
- package/collections/monitor-cpu.collection.d.ts +0 -3
- package/collections/monitor-cpu.collection.js +0 -65
- package/collections/monitor-cpu.collection.js.map +0 -1
- package/collections/monitor-function.collection.d.ts +0 -3
- package/collections/monitor-function.collection.js +0 -74
- package/collections/monitor-function.collection.js.map +0 -1
- package/collections/monitor-memory.collection.d.ts +0 -3
- package/collections/monitor-memory.collection.js +0 -77
- package/collections/monitor-memory.collection.js.map +0 -1
- package/collections/monitor-mongo.collection.d.ts +0 -3
- package/collections/monitor-mongo.collection.js +0 -71
- package/collections/monitor-mongo.collection.js.map +0 -1
- package/collections/notification.collection.d.ts +0 -3
- package/collections/notification.collection.js +0 -57
- package/collections/notification.collection.js.map +0 -1
- package/collections/openai-usage-ledger.collection.d.ts +0 -2
- package/collections/openai-usage-ledger.collection.js +0 -188
- package/collections/openai-usage-ledger.collection.js.map +0 -1
- package/collections/report-builder-dashboard-builder.collection.d.ts +0 -3
- package/collections/report-builder-dashboard-builder.collection.js +0 -109
- package/collections/report-builder-dashboard-builder.collection.js.map +0 -1
- package/collections/report-builder-library.collection.d.ts +0 -3
- package/collections/report-builder-library.collection.js +0 -87
- package/collections/report-builder-library.collection.js.map +0 -1
- package/collections/report-builder-report.collection.d.ts +0 -4
- package/collections/report-builder-report.collection.js +0 -184
- package/collections/report-builder-report.collection.js.map +0 -1
- package/collections/user-group.collection.d.ts +0 -4
- package/collections/user-group.collection.js +0 -89
- package/collections/user-group.collection.js.map +0 -1
- package/collections/user-guide.collection.d.ts +0 -3
- package/collections/user-guide.collection.js +0 -57
- package/collections/user-guide.collection.js.map +0 -1
- package/collections/user.collection.d.ts +0 -4
- package/collections/user.collection.js +0 -180
- package/collections/user.collection.js.map +0 -1
- package/cron/cron.d.ts +0 -14
- package/cron/cron.js +0 -216
- package/cron/cron.js.map +0 -1
- package/fixtures/cron-jobs.d.ts +0 -1
- package/fixtures/cron-jobs.js +0 -150
- package/fixtures/cron-jobs.js.map +0 -1
- package/fixtures/init.d.ts +0 -1
- package/fixtures/init.js +0 -91
- package/fixtures/init.js.map +0 -1
- package/http/auth.d.ts +0 -2
- package/http/auth.js +0 -951
- package/http/auth.js.map +0 -1
- package/http/health.d.ts +0 -1
- package/http/health.js +0 -11
- package/http/health.js.map +0 -1
- package/http/home.d.ts +0 -1
- package/http/home.js +0 -134
- package/http/home.js.map +0 -1
- package/http/slow-query-publication.d.ts +0 -2
- package/http/slow-query-publication.js +0 -99
- package/http/slow-query-publication.js.map +0 -1
- package/index.d.ts +0 -1
- package/index.js +0 -19
- package/index.js.map +0 -1
- package/managers/ai-assistant-codex-manager.manager.d.ts +0 -67
- package/managers/ai-assistant-codex-manager.manager.js +0 -1113
- package/managers/ai-assistant-codex-manager.manager.js.map +0 -1
- package/managers/ai-run-evidence.manager.d.ts +0 -36
- package/managers/ai-run-evidence.manager.js +0 -377
- package/managers/ai-run-evidence.manager.js.map +0 -1
- package/managers/communication-metric.manager.d.ts +0 -16
- package/managers/communication-metric.manager.js +0 -134
- package/managers/communication-metric.manager.js.map +0 -1
- package/managers/cron.manager.d.ts +0 -20
- package/managers/cron.manager.js +0 -534
- package/managers/cron.manager.js.map +0 -1
- package/managers/customer-notification-content.manager.d.ts +0 -55
- package/managers/customer-notification-content.manager.js +0 -158
- package/managers/customer-notification-content.manager.js.map +0 -1
- package/managers/diagnostic-manager-bootstrap.d.ts +0 -9
- package/managers/diagnostic-manager-bootstrap.js +0 -260
- package/managers/diagnostic-manager-bootstrap.js.map +0 -1
- package/managers/error-auto-fix.manager.d.ts +0 -149
- package/managers/error-auto-fix.manager.js +0 -3064
- package/managers/error-auto-fix.manager.js.map +0 -1
- package/managers/local-log.manager.d.ts +0 -18
- package/managers/local-log.manager.js +0 -88
- package/managers/local-log.manager.js.map +0 -1
- package/managers/method.manager.d.ts +0 -84
- package/managers/method.manager.js +0 -1964
- package/managers/method.manager.js.map +0 -1
- package/managers/mongo.manager.d.ts +0 -224
- package/managers/mongo.manager.js +0 -5000
- package/managers/mongo.manager.js.map +0 -1
- package/managers/monitor.manager.d.ts +0 -70
- package/managers/monitor.manager.js +0 -550
- package/managers/monitor.manager.js.map +0 -1
- package/managers/openai-usage-ledger.manager.d.ts +0 -30
- package/managers/openai-usage-ledger.manager.js +0 -142
- package/managers/openai-usage-ledger.manager.js.map +0 -1
- package/managers/slow-query-verifier.manager.d.ts +0 -144
- package/managers/slow-query-verifier.manager.js +0 -3857
- package/managers/slow-query-verifier.manager.js.map +0 -1
- package/managers/slow-query.manager.d.ts +0 -28
- package/managers/slow-query.manager.js +0 -468
- package/managers/slow-query.manager.js.map +0 -1
- package/managers/subscription.manager.d.ts +0 -169
- package/managers/subscription.manager.js +0 -3434
- package/managers/subscription.manager.js.map +0 -1
- package/managers/websocket.manager.d.ts +0 -73
- package/managers/websocket.manager.js +0 -673
- package/managers/websocket.manager.js.map +0 -1
- package/managers/worker-dispatcher.manager.d.ts +0 -120
- package/managers/worker-dispatcher.manager.js +0 -1266
- package/managers/worker-dispatcher.manager.js.map +0 -1
- package/managers/worker-server.manager.d.ts +0 -35
- package/managers/worker-server.manager.js +0 -582
- package/managers/worker-server.manager.js.map +0 -1
- package/methods/accounts.d.ts +0 -2
- package/methods/accounts.js +0 -624
- package/methods/accounts.js.map +0 -1
- package/methods/ai-terminal.d.ts +0 -338
- package/methods/ai-terminal.js +0 -23454
- package/methods/ai-terminal.js.map +0 -1
- package/methods/app-settings.d.ts +0 -2
- package/methods/app-settings.js +0 -169
- package/methods/app-settings.js.map +0 -1
- package/methods/aws.d.ts +0 -2
- package/methods/aws.js +0 -877
- package/methods/aws.js.map +0 -1
- package/methods/collections.d.ts +0 -2
- package/methods/collections.js +0 -719
- package/methods/collections.js.map +0 -1
- package/methods/counters.d.ts +0 -2
- package/methods/counters.js +0 -113
- package/methods/counters.js.map +0 -1
- package/methods/cron-jobs.d.ts +0 -2
- package/methods/cron-jobs.js +0 -2475
- package/methods/cron-jobs.js.map +0 -1
- package/methods/customer-notifications.d.ts +0 -2
- package/methods/customer-notifications.js +0 -528
- package/methods/customer-notifications.js.map +0 -1
- package/methods/diagnostics.d.ts +0 -2
- package/methods/diagnostics.js +0 -703
- package/methods/diagnostics.js.map +0 -1
- package/methods/flag-updates.d.ts +0 -2
- package/methods/flag-updates.js +0 -8
- package/methods/flag-updates.js.map +0 -1
- package/methods/flags.d.ts +0 -2
- package/methods/flags.js +0 -8
- package/methods/flags.js.map +0 -1
- package/methods/logs.d.ts +0 -2
- package/methods/logs.js +0 -751
- package/methods/logs.js.map +0 -1
- package/methods/mongo-explorer.d.ts +0 -2
- package/methods/mongo-explorer.js +0 -1808
- package/methods/mongo-explorer.js.map +0 -1
- package/methods/monitor.d.ts +0 -2
- package/methods/monitor.js +0 -543
- package/methods/monitor.js.map +0 -1
- package/methods/pdf.d.ts +0 -2
- package/methods/pdf.js +0 -1216
- package/methods/pdf.js.map +0 -1
- package/methods/publications.d.ts +0 -1
- package/methods/publications.js +0 -183
- package/methods/publications.js.map +0 -1
- package/methods/report-builder.d.ts +0 -2
- package/methods/report-builder.js +0 -3094
- package/methods/report-builder.js.map +0 -1
- package/methods/support.d.ts +0 -2
- package/methods/support.js +0 -430
- package/methods/support.js.map +0 -1
- package/models/ai-run.model.d.ts +0 -19
- package/models/ai-run.model.js +0 -4
- package/models/ai-run.model.js.map +0 -1
- package/models/ai-terminal-conversation.model.d.ts +0 -17
- package/models/ai-terminal-conversation.model.js +0 -4
- package/models/ai-terminal-conversation.model.js.map +0 -1
- package/models/ai-terminal-issue-report.model.d.ts +0 -19
- package/models/ai-terminal-issue-report.model.js +0 -4
- package/models/ai-terminal-issue-report.model.js.map +0 -1
- package/models/ai-terminal-message.model.d.ts +0 -22
- package/models/ai-terminal-message.model.js +0 -4
- package/models/ai-terminal-message.model.js.map +0 -1
- package/models/app-setting.model.d.ts +0 -16
- package/models/app-setting.model.js +0 -4
- package/models/app-setting.model.js.map +0 -1
- package/models/app-status.model.js +0 -4
- package/models/app-status.model.js.map +0 -1
- package/models/billing-logged-in-users.model.js +0 -4
- package/models/billing-logged-in-users.model.js.map +0 -1
- package/models/collection-document.model.d.ts +0 -21
- package/models/collection-document.model.js +0 -4
- package/models/collection-document.model.js.map +0 -1
- package/models/communication-metric.model.d.ts +0 -20
- package/models/communication-metric.model.js +0 -4
- package/models/communication-metric.model.js.map +0 -1
- package/models/counter.model.js +0 -4
- package/models/counter.model.js.map +0 -1
- package/models/cron-job-history.model.d.ts +0 -15
- package/models/cron-job-history.model.js +0 -4
- package/models/cron-job-history.model.js.map +0 -1
- package/models/cron-job.model.d.ts +0 -14
- package/models/cron-job.model.js +0 -4
- package/models/cron-job.model.js.map +0 -1
- package/models/customer-notification.model.d.ts +0 -26
- package/models/customer-notification.model.js +0 -4
- package/models/customer-notification.model.js.map +0 -1
- package/models/customer-portal-password.model.d.ts +0 -11
- package/models/customer-portal-password.model.js +0 -4
- package/models/customer-portal-password.model.js.map +0 -1
- package/models/dialog.model.d.ts +0 -23
- package/models/dialog.model.js +0 -4
- package/models/dialog.model.js.map +0 -1
- package/models/email-history.model.d.ts +0 -32
- package/models/email-history.model.js.map +0 -1
- package/models/email-verified.model.js +0 -4
- package/models/email-verified.model.js.map +0 -1
- package/models/file.model.js +0 -4
- package/models/file.model.js.map +0 -1
- package/models/flag-update.model.js +0 -4
- package/models/flag-update.model.js.map +0 -1
- package/models/flag.model.js +0 -4
- package/models/flag.model.js.map +0 -1
- package/models/log-method-latency.model.d.ts +0 -10
- package/models/log-method-latency.model.js +0 -4
- package/models/log-method-latency.model.js.map +0 -1
- package/models/log-subscription.model.js +0 -4
- package/models/log-subscription.model.js.map +0 -1
- package/models/log.model.d.ts +0 -17
- package/models/log.model.js +0 -4
- package/models/log.model.js.map +0 -1
- package/models/logged-in-users.model.js +0 -4
- package/models/logged-in-users.model.js.map +0 -1
- package/models/method-response.model.js +0 -4
- package/models/method-response.model.js.map +0 -1
- package/models/method.model.d.ts +0 -26
- package/models/method.model.js +0 -4
- package/models/method.model.js.map +0 -1
- package/models/monitor-cpu.model.js +0 -4
- package/models/monitor-cpu.model.js.map +0 -1
- package/models/monitor-function.model.d.ts +0 -14
- package/models/monitor-function.model.js +0 -4
- package/models/monitor-function.model.js.map +0 -1
- package/models/monitor-memory.model.d.ts +0 -15
- package/models/monitor-memory.model.js +0 -4
- package/models/monitor-memory.model.js.map +0 -1
- package/models/monitor-mongo.model.d.ts +0 -13
- package/models/monitor-mongo.model.js +0 -4
- package/models/monitor-mongo.model.js.map +0 -1
- package/models/notification.model.js +0 -4
- package/models/notification.model.js.map +0 -1
- package/models/openai-usage-ledger.model.d.ts +0 -30
- package/models/openai-usage-ledger.model.js +0 -4
- package/models/openai-usage-ledger.model.js.map +0 -1
- package/models/pagination.model.d.ts +0 -11
- package/models/pagination.model.js +0 -28
- package/models/pagination.model.js.map +0 -1
- package/models/permission.model.d.ts +0 -12
- package/models/permission.model.js +0 -4
- package/models/permission.model.js.map +0 -1
- package/models/report-builder-dashboard-builder.model.d.ts +0 -25
- package/models/report-builder-dashboard-builder.model.js +0 -4
- package/models/report-builder-dashboard-builder.model.js.map +0 -1
- package/models/report-builder-library.model.d.ts +0 -17
- package/models/report-builder-library.model.js +0 -4
- package/models/report-builder-library.model.js.map +0 -1
- package/models/report-builder-report.model.d.ts +0 -121
- package/models/report-builder-report.model.js +0 -4
- package/models/report-builder-report.model.js.map +0 -1
- package/models/report-builder.model.d.ts +0 -61
- package/models/report-builder.model.js +0 -4
- package/models/report-builder.model.js.map +0 -1
- package/models/select-data-label.model.d.ts +0 -9
- package/models/select-data-label.model.js +0 -4
- package/models/select-data-label.model.js.map +0 -1
- package/models/server-message.model.d.ts +0 -32
- package/models/server-message.model.js +0 -4
- package/models/server-message.model.js.map +0 -1
- package/models/slow-query-report.model.d.ts +0 -23
- package/models/slow-query-report.model.js +0 -4
- package/models/slow-query-report.model.js.map +0 -1
- package/models/subscription.model.d.ts +0 -31
- package/models/subscription.model.js +0 -4
- package/models/subscription.model.js.map +0 -1
- package/models/support-ticket.model.d.ts +0 -87
- package/models/support-ticket.model.js +0 -4
- package/models/support-ticket.model.js.map +0 -1
- package/models/user-group.model.d.ts +0 -20
- package/models/user-group.model.js +0 -4
- package/models/user-group.model.js.map +0 -1
- package/models/user-guide.model.js +0 -4
- package/models/user-guide.model.js.map +0 -1
- package/models/user.model.d.ts +0 -84
- package/models/user.model.js +0 -4
- package/models/user.model.js.map +0 -1
- package/private/images/ResolveIO.png +0 -0
- package/public_api.js +0 -127
- package/public_api.js.map +0 -1
- package/publications/ai-terminal.d.ts +0 -1
- package/publications/ai-terminal.js +0 -122
- package/publications/ai-terminal.js.map +0 -1
- package/publications/app-settings.d.ts +0 -2
- package/publications/app-settings.js +0 -28
- package/publications/app-settings.js.map +0 -1
- package/publications/app-status.d.ts +0 -2
- package/publications/app-status.js +0 -16
- package/publications/app-status.js.map +0 -1
- package/publications/cron-jobs.d.ts +0 -2
- package/publications/cron-jobs.js +0 -88
- package/publications/cron-jobs.js.map +0 -1
- package/publications/customer-notifications.d.ts +0 -2
- package/publications/customer-notifications.js +0 -161
- package/publications/customer-notifications.js.map +0 -1
- package/publications/files.d.ts +0 -2
- package/publications/files.js +0 -36
- package/publications/files.js.map +0 -1
- package/publications/flags-update.d.ts +0 -2
- package/publications/flags-update.js +0 -22
- package/publications/flags-update.js.map +0 -1
- package/publications/flags.d.ts +0 -2
- package/publications/flags.js +0 -22
- package/publications/flags.js.map +0 -1
- package/publications/logs.d.ts +0 -2
- package/publications/logs.js +0 -164
- package/publications/logs.js.map +0 -1
- package/publications/notifications.d.ts +0 -2
- package/publications/notifications.js +0 -16
- package/publications/notifications.js.map +0 -1
- package/publications/report-builder-dashboard-builders.d.ts +0 -2
- package/publications/report-builder-dashboard-builders.js +0 -42
- package/publications/report-builder-dashboard-builders.js.map +0 -1
- package/publications/report-builder-libraries.d.ts +0 -2
- package/publications/report-builder-libraries.js +0 -90
- package/publications/report-builder-libraries.js.map +0 -1
- package/publications/report-builder-reports.d.ts +0 -2
- package/publications/report-builder-reports.js +0 -50
- package/publications/report-builder-reports.js.map +0 -1
- package/publications/super-admin.d.ts +0 -2
- package/publications/super-admin.js +0 -16
- package/publications/super-admin.js.map +0 -1
- package/publications/user-groups.d.ts +0 -1
- package/publications/user-groups.js +0 -16
- package/publications/user-groups.js.map +0 -1
- package/publications/user-guides.d.ts +0 -1
- package/publications/user-guides.js +0 -16
- package/publications/user-guides.js.map +0 -1
- package/resolveio-server-app.d.ts +0 -70
- package/resolveio-server-app.js +0 -801
- package/resolveio-server-app.js.map +0 -1
- package/server-app.d.ts +0 -228
- package/server-app.js +0 -3566
- package/server-app.js.map +0 -1
- package/services/codex-client.d.ts +0 -128
- package/services/codex-client.js +0 -1629
- package/services/codex-client.js.map +0 -1
- package/services/openai-client.d.ts +0 -46
- package/services/openai-client.js +0 -318
- package/services/openai-client.js.map +0 -1
- package/types/error-report.d.ts +0 -25
- package/types/error-report.js +0 -4
- package/types/error-report.js.map +0 -1
- package/types/slow-query-report.d.ts +0 -27
- package/types/slow-query-report.js +0 -6
- package/types/slow-query-report.js.map +0 -1
- package/util/ai-qa-policy.d.ts +0 -124
- package/util/ai-qa-policy.js +0 -736
- package/util/ai-qa-policy.js.map +0 -1
- package/util/ai-run-evidence-adapters.d.ts +0 -73
- package/util/ai-run-evidence-adapters.js +0 -2986
- package/util/ai-run-evidence-adapters.js.map +0 -1
- package/util/ai-run-evidence-dashboard.d.ts +0 -84
- package/util/ai-run-evidence-dashboard.js +0 -336
- package/util/ai-run-evidence-dashboard.js.map +0 -1
- package/util/ai-run-evidence-eval.d.ts +0 -86
- package/util/ai-run-evidence-eval.js +0 -854
- package/util/ai-run-evidence-eval.js.map +0 -1
- package/util/ai-run-evidence.d.ts +0 -244
- package/util/ai-run-evidence.js +0 -778
- package/util/ai-run-evidence.js.map +0 -1
- package/util/ai-runner-artifacts.d.ts +0 -82
- package/util/ai-runner-artifacts.js +0 -713
- package/util/ai-runner-artifacts.js.map +0 -1
- package/util/ai-runner-manager-autopilot.d.ts +0 -210
- package/util/ai-runner-manager-autopilot.js +0 -642
- package/util/ai-runner-manager-autopilot.js.map +0 -1
- package/util/ai-runner-manager-policy.d.ts +0 -653
- package/util/ai-runner-manager-policy.js +0 -2880
- package/util/ai-runner-manager-policy.js.map +0 -1
- package/util/ai-runner-qa-auth.d.ts +0 -5
- package/util/ai-runner-qa-auth.js +0 -822
- package/util/ai-runner-qa-auth.js.map +0 -1
- package/util/ai-runner-qa-tools.d.ts +0 -26
- package/util/ai-runner-qa-tools.js +0 -3029
- package/util/ai-runner-qa-tools.js.map +0 -1
- package/util/aicoder-runner-v6.d.ts +0 -367
- package/util/aicoder-runner-v6.js +0 -1925
- package/util/aicoder-runner-v6.js.map +0 -1
- package/util/common.d.ts +0 -31
- package/util/common.js +0 -683
- package/util/common.js.map +0 -1
- package/util/customer-portal-password.d.ts +0 -13
- package/util/customer-portal-password.js +0 -209
- package/util/customer-portal-password.js.map +0 -1
- package/util/error-reporter.d.ts +0 -52
- package/util/error-reporter.js +0 -326
- package/util/error-reporter.js.map +0 -1
- package/util/error-tracking.d.ts +0 -13
- package/util/error-tracking.js +0 -120
- package/util/error-tracking.js.map +0 -1
- package/util/openai-usage-cost.d.ts +0 -6
- package/util/openai-usage-cost.js +0 -103
- package/util/openai-usage-cost.js.map +0 -1
- package/util/report-builder-unwinds.d.ts +0 -15
- package/util/report-builder-unwinds.js +0 -156
- package/util/report-builder-unwinds.js.map +0 -1
- package/util/runner-process-janitor.d.ts +0 -27
- package/util/runner-process-janitor.js +0 -208
- package/util/runner-process-janitor.js.map +0 -1
- package/util/schema-report-builder.d.ts +0 -6
- package/util/schema-report-builder.js +0 -481
- package/util/schema-report-builder.js.map +0 -1
- package/util/slow-query-reporter.d.ts +0 -28
- package/util/slow-query-reporter.js +0 -226
- package/util/slow-query-reporter.js.map +0 -1
- package/util/subscription-dependency-context.d.ts +0 -34
- package/util/subscription-dependency-context.js +0 -1283
- package/util/subscription-dependency-context.js.map +0 -1
- package/util/support-runner-v5.d.ts +0 -810
- package/util/support-runner-v5.js +0 -3497
- package/util/support-runner-v5.js.map +0 -1
- package/util/tokenizer.d.ts +0 -5
- package/util/tokenizer.js +0 -41
- package/util/tokenizer.js.map +0 -1
- package/workers/codex-runner.worker.d.ts +0 -1
- package/workers/codex-runner.worker.js +0 -192
- package/workers/codex-runner.worker.js.map +0 -1
- /package/{private → src/private}/email-templates/enrollment.html +0 -0
- /package/{private → src/private}/email-templates/forgot-password.html +0 -0
- /package/{private → src/private}/email-templates/support-ticket-deleted.html +0 -0
- /package/{private → src/private}/email-templates/support-ticket-modified.html +0 -0
- /package/{private → src/private}/email-templates/support-ticket.html +0 -0
- /package/{public_api.d.ts → src/public_api.ts} +0 -0
|
@@ -1,2986 +0,0 @@
|
|
|
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.buildSupportAIRunFromEvidence = buildSupportAIRunFromEvidence;
|
|
52
|
-
exports.buildAICoderAIRunFromEvidence = buildAICoderAIRunFromEvidence;
|
|
53
|
-
exports.buildAssistantAIRunFromEvidence = buildAssistantAIRunFromEvidence;
|
|
54
|
-
var ai_run_evidence_1 = require("./ai-run-evidence");
|
|
55
|
-
var aicoder_runner_v6_1 = require("./aicoder-runner-v6");
|
|
56
|
-
var ai_runner_manager_policy_1 = require("./ai-runner-manager-policy");
|
|
57
|
-
var support_runner_v5_1 = require("./support-runner-v5");
|
|
58
|
-
function cleanText(value, max) {
|
|
59
|
-
if (max === void 0) { max = 1000; }
|
|
60
|
-
return String(value || '').replace(/\s+/g, ' ').trim().slice(0, max);
|
|
61
|
-
}
|
|
62
|
-
function idText(value, max) {
|
|
63
|
-
if (max === void 0) { max = 160; }
|
|
64
|
-
var normalized = cleanText(value, max);
|
|
65
|
-
return normalized || undefined;
|
|
66
|
-
}
|
|
67
|
-
function asArray(value) {
|
|
68
|
-
return Array.isArray(value) ? value : [];
|
|
69
|
-
}
|
|
70
|
-
function cleanStringList(value, limit, max) {
|
|
71
|
-
if (limit === void 0) { limit = 40; }
|
|
72
|
-
if (max === void 0) { max = 500; }
|
|
73
|
-
return asArray(value)
|
|
74
|
-
.map(function (entry) { return cleanText(entry, max); })
|
|
75
|
-
.filter(Boolean)
|
|
76
|
-
.slice(0, limit);
|
|
77
|
-
}
|
|
78
|
-
function plainObject(value) {
|
|
79
|
-
return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
80
|
-
}
|
|
81
|
-
function firstText(source, fields, max) {
|
|
82
|
-
var e_1, _a;
|
|
83
|
-
if (max === void 0) { max = 1000; }
|
|
84
|
-
try {
|
|
85
|
-
for (var fields_1 = __values(fields), fields_1_1 = fields_1.next(); !fields_1_1.done; fields_1_1 = fields_1.next()) {
|
|
86
|
-
var field = fields_1_1.value;
|
|
87
|
-
var value = source === null || source === void 0 ? void 0 : source[field];
|
|
88
|
-
var normalized = idText(value, max);
|
|
89
|
-
if (normalized) {
|
|
90
|
-
return normalized;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
95
|
-
finally {
|
|
96
|
-
try {
|
|
97
|
-
if (fields_1_1 && !fields_1_1.done && (_a = fields_1.return)) _a.call(fields_1);
|
|
98
|
-
}
|
|
99
|
-
finally { if (e_1) throw e_1.error; }
|
|
100
|
-
}
|
|
101
|
-
return undefined;
|
|
102
|
-
}
|
|
103
|
-
function dateValue(source, fields) {
|
|
104
|
-
var e_2, _a;
|
|
105
|
-
try {
|
|
106
|
-
for (var fields_2 = __values(fields), fields_2_1 = fields_2.next(); !fields_2_1.done; fields_2_1 = fields_2.next()) {
|
|
107
|
-
var field = fields_2_1.value;
|
|
108
|
-
var value = source === null || source === void 0 ? void 0 : source[field];
|
|
109
|
-
if (value) {
|
|
110
|
-
return value;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
115
|
-
finally {
|
|
116
|
-
try {
|
|
117
|
-
if (fields_2_1 && !fields_2_1.done && (_a = fields_2.return)) _a.call(fields_2);
|
|
118
|
-
}
|
|
119
|
-
finally { if (e_2) throw e_2.error; }
|
|
120
|
-
}
|
|
121
|
-
return undefined;
|
|
122
|
-
}
|
|
123
|
-
function addSourceId(sourceIds, key, value) {
|
|
124
|
-
var normalized = idText(value);
|
|
125
|
-
if (normalized) {
|
|
126
|
-
sourceIds[key] = normalized;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
function pushEvent(events, event) {
|
|
130
|
-
var _a;
|
|
131
|
-
var message = cleanText(event.message, 1800);
|
|
132
|
-
var metadata = event.metadata || {};
|
|
133
|
-
if (!message && !Object.keys(metadata).length && !((_a = event.artifactPaths) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
events.push(__assign(__assign({}, event), { message: message, artifactPaths: asArray(event.artifactPaths).filter(Boolean).slice(0, 20) }));
|
|
137
|
-
}
|
|
138
|
-
function eventDate(record) {
|
|
139
|
-
return dateValue(record, ['recordedAt', 'createdAt', 'updatedAt', 'timestamp', 'time', 'date']);
|
|
140
|
-
}
|
|
141
|
-
function normalizeManagerFailureRecord(value, fallback) {
|
|
142
|
-
if (fallback === void 0) { fallback = {}; }
|
|
143
|
-
var entry = plainObject(value);
|
|
144
|
-
if (!Object.keys(entry).length && !Object.keys(fallback).length) {
|
|
145
|
-
return undefined;
|
|
146
|
-
}
|
|
147
|
-
var blocker = cleanText(entry.blocker || entry.reason || entry.summary || entry.message || fallback.blocker || fallback.summary, 1200);
|
|
148
|
-
var failureClass = cleanText(entry.failureClass || entry.failure_class || entry.class || fallback.failureClass, 120);
|
|
149
|
-
var evidenceHash = cleanText(entry.evidenceHash || entry.evidence_hash || entry.hash || fallback.evidenceHash, 180);
|
|
150
|
-
var blockerFingerprint = cleanText(entry.blockerFingerprint || entry.blocker_fingerprint || fallback.blockerFingerprint, 180);
|
|
151
|
-
var lane = cleanText(entry.lane || fallback.lane || 'support', 80);
|
|
152
|
-
var stepType = cleanText(entry.stepType || entry.step_type || entry.type || fallback.stepType || 'support_step', 80);
|
|
153
|
-
var outcome = cleanText(entry.outcome || entry.status || entry.result || fallback.outcome || 'needs_repair', 80);
|
|
154
|
-
if (!blocker && !failureClass && !evidenceHash && !blockerFingerprint) {
|
|
155
|
-
return undefined;
|
|
156
|
-
}
|
|
157
|
-
return {
|
|
158
|
-
lane: lane,
|
|
159
|
-
stepType: stepType,
|
|
160
|
-
outcome: outcome,
|
|
161
|
-
failureClass: failureClass || undefined,
|
|
162
|
-
blocker: blocker || undefined,
|
|
163
|
-
summary: cleanText(entry.summary || entry.message || fallback.summary, 1200) || undefined,
|
|
164
|
-
blockerFingerprint: blockerFingerprint || undefined,
|
|
165
|
-
evidenceHash: evidenceHash || undefined,
|
|
166
|
-
changedFiles: cleanStringList(entry.changedFiles || entry.changed_files || fallback.changedFiles, 80, 500),
|
|
167
|
-
artifactPaths: cleanStringList(entry.artifactPaths || entry.artifact_paths || entry.artifacts || fallback.artifactPaths, 80, 500)
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
function supportManagerFailureRecords(job, evidence) {
|
|
171
|
-
var e_3, _a, e_4, _b;
|
|
172
|
-
var records = [];
|
|
173
|
-
var pushRecord = function (value, fallback) {
|
|
174
|
-
if (fallback === void 0) { fallback = {}; }
|
|
175
|
-
var record = normalizeManagerFailureRecord(value, fallback);
|
|
176
|
-
if (record) {
|
|
177
|
-
records.push(record);
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
try {
|
|
181
|
-
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()) {
|
|
182
|
-
var entry = _d.value;
|
|
183
|
-
pushRecord(entry);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
187
|
-
finally {
|
|
188
|
-
try {
|
|
189
|
-
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
190
|
-
}
|
|
191
|
-
finally { if (e_3) throw e_3.error; }
|
|
192
|
-
}
|
|
193
|
-
try {
|
|
194
|
-
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()) {
|
|
195
|
-
var entry = _f.value;
|
|
196
|
-
var fingerprint = plainObject(entry);
|
|
197
|
-
var count = Math.max(1, Math.min(8, Number(fingerprint.count || fingerprint.repeatedCount || fingerprint.repeated_count || 1) || 1));
|
|
198
|
-
var fallback = {
|
|
199
|
-
lane: cleanText(fingerprint.lane || 'support', 80),
|
|
200
|
-
stepType: cleanText(fingerprint.stepType || fingerprint.step_type || 'support_step', 80),
|
|
201
|
-
outcome: cleanText(fingerprint.outcome || 'needs_repair', 80),
|
|
202
|
-
failureClass: cleanText(fingerprint.failureClass || fingerprint.failure_class || fingerprint.class, 120),
|
|
203
|
-
blocker: cleanText(fingerprint.blocker || fingerprint.reason || fingerprint.summary, 1200),
|
|
204
|
-
blockerFingerprint: cleanText(fingerprint.blockerFingerprint || fingerprint.blocker_fingerprint, 180),
|
|
205
|
-
evidenceHash: cleanText(fingerprint.evidenceHash || fingerprint.evidence_hash, 180)
|
|
206
|
-
};
|
|
207
|
-
for (var index = 0; index < count; index += 1) {
|
|
208
|
-
pushRecord(fingerprint, fallback);
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
213
|
-
finally {
|
|
214
|
-
try {
|
|
215
|
-
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
216
|
-
}
|
|
217
|
-
finally { if (e_4) throw e_4.error; }
|
|
218
|
-
}
|
|
219
|
-
var currentFailure = evidenceObject(job.supportV5CurrentFailure, job.support_v5_current_failure, job.supportV5RecoveryCurrent, job.support_v5_recovery_current, evidence.currentFailure, evidence.current_failure);
|
|
220
|
-
pushRecord(currentFailure);
|
|
221
|
-
return records.slice(-80);
|
|
222
|
-
}
|
|
223
|
-
function managerNoBlindLoopGateFromHistory(history, budgetSource, now) {
|
|
224
|
-
var _a;
|
|
225
|
-
if (!history.length) {
|
|
226
|
-
return undefined;
|
|
227
|
-
}
|
|
228
|
-
var budget = plainObject(budgetSource);
|
|
229
|
-
var maxSameFailureRepeats = Math.max(1, Number(budget.maxRepeatedNoProgress || budget.max_repeated_no_progress || budget.maxSameFailureRepeats || budget.max_same_failure_repeats || 3) || 3);
|
|
230
|
-
var decision = (0, ai_runner_manager_policy_1.decideResolveIOAIManagerPolicy)({
|
|
231
|
-
history: history,
|
|
232
|
-
maxSameFailureRepeats: maxSameFailureRepeats
|
|
233
|
-
});
|
|
234
|
-
var parksRun = /^(park_repeated_failure|park_ping_pong|manual_handoff)$/.test(decision.action);
|
|
235
|
-
var status = parksRun
|
|
236
|
-
? 'blocked'
|
|
237
|
-
: decision.action === 'retry_infra'
|
|
238
|
-
? 'warn'
|
|
239
|
-
: 'pass';
|
|
240
|
-
return {
|
|
241
|
-
key: 'manager_no_blind_loop_policy',
|
|
242
|
-
label: 'No-blind-loop manager policy',
|
|
243
|
-
status: status,
|
|
244
|
-
reason: decision.reason,
|
|
245
|
-
evidenceRefs: cleanStringList(decision.recoveryAction.requiredArtifacts, 20, 500),
|
|
246
|
-
recordedAt: isoNow(now),
|
|
247
|
-
metadata: {
|
|
248
|
-
action: decision.action,
|
|
249
|
-
failureClass: decision.failureClass,
|
|
250
|
-
blockerFingerprint: decision.blockerFingerprint,
|
|
251
|
-
evidenceHash: decision.evidenceHash,
|
|
252
|
-
sameFailureCount: decision.sameFailureCount,
|
|
253
|
-
pingPongCount: decision.pingPongCount,
|
|
254
|
-
newEvidence: decision.newEvidence,
|
|
255
|
-
materialEvidence: decision.materialEvidence,
|
|
256
|
-
evidenceStrength: decision.evidenceStrength,
|
|
257
|
-
evidenceSignals: decision.evidenceSignals,
|
|
258
|
-
loopBudgetShouldReset: decision.loopBudgetShouldReset,
|
|
259
|
-
productRepairFailure: decision.productRepairFailure,
|
|
260
|
-
recoveryClass: decision.recoveryPlan.recoveryClass,
|
|
261
|
-
allowedAction: decision.recoveryPlan.allowedAction,
|
|
262
|
-
dispatchAction: decision.recoveryAction.allowedDispatchAction,
|
|
263
|
-
evidenceOnly: decision.recoveryAction.evidenceOnly,
|
|
264
|
-
productRepairAllowed: decision.recoveryAction.productRepairAllowed,
|
|
265
|
-
expensiveModelAllowed: decision.recoveryAction.expensiveModelAllowed,
|
|
266
|
-
costCeilingUsd: decision.recoveryAction.costCeilingUsd,
|
|
267
|
-
requiresNewEvidence: ((_a = decision.recoveryAction.retryPolicy) === null || _a === void 0 ? void 0 : _a.requireNewEvidence) === true,
|
|
268
|
-
nextCommands: decision.recoveryAction.nextCommands,
|
|
269
|
-
requiredEvidence: decision.recoveryAction.requiredArtifacts,
|
|
270
|
-
forbiddenActions: decision.recoveryPlan.forbiddenActions
|
|
271
|
-
}
|
|
272
|
-
};
|
|
273
|
-
}
|
|
274
|
-
function supportManagerNoBlindLoopGate(job, evidence, now) {
|
|
275
|
-
return managerNoBlindLoopGateFromHistory(supportManagerFailureRecords(job, evidence), job.supportV5Budget || job.support_v5_budget || evidence.supportV5Budget || evidence.support_v5_budget, now);
|
|
276
|
-
}
|
|
277
|
-
function aicoderManagerFailureRecords(app, job, evidence) {
|
|
278
|
-
var e_5, _a, e_6, _b, e_7, _c, e_8, _d;
|
|
279
|
-
var records = [];
|
|
280
|
-
var pushRecord = function (value, fallback) {
|
|
281
|
-
if (fallback === void 0) { fallback = {}; }
|
|
282
|
-
var record = normalizeManagerFailureRecord(value, __assign({ lane: 'aicoder', stepType: 'workflow_step' }, fallback));
|
|
283
|
-
if (record) {
|
|
284
|
-
records.push(record);
|
|
285
|
-
}
|
|
286
|
-
};
|
|
287
|
-
var historySources = [
|
|
288
|
-
job.aicoderV6StepHistory,
|
|
289
|
-
job.aiCoderV6StepHistory,
|
|
290
|
-
job.aicoder_v6_step_history,
|
|
291
|
-
job.ai_coder_v6_step_history,
|
|
292
|
-
job.workflowStepHistory,
|
|
293
|
-
job.workflow_step_history,
|
|
294
|
-
job.stepHistory,
|
|
295
|
-
job.step_history,
|
|
296
|
-
job.managerFailureHistory,
|
|
297
|
-
job.manager_failure_history,
|
|
298
|
-
app.aicoderV6StepHistory,
|
|
299
|
-
app.aiCoderV6StepHistory,
|
|
300
|
-
app.aicoder_v6_step_history,
|
|
301
|
-
app.ai_coder_v6_step_history,
|
|
302
|
-
app.workflowStepHistory,
|
|
303
|
-
app.workflow_step_history,
|
|
304
|
-
evidence.aicoderV6StepHistory,
|
|
305
|
-
evidence.aiCoderV6StepHistory,
|
|
306
|
-
evidence.aicoder_v6_step_history,
|
|
307
|
-
evidence.ai_coder_v6_step_history,
|
|
308
|
-
evidence.workflowStepHistory,
|
|
309
|
-
evidence.workflow_step_history,
|
|
310
|
-
evidence.stepHistory,
|
|
311
|
-
evidence.step_history,
|
|
312
|
-
evidence.managerFailureHistory,
|
|
313
|
-
evidence.manager_failure_history
|
|
314
|
-
];
|
|
315
|
-
try {
|
|
316
|
-
for (var historySources_1 = __values(historySources), historySources_1_1 = historySources_1.next(); !historySources_1_1.done; historySources_1_1 = historySources_1.next()) {
|
|
317
|
-
var source = historySources_1_1.value;
|
|
318
|
-
try {
|
|
319
|
-
for (var _e = (e_6 = void 0, __values(asArray(source))), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
320
|
-
var entry = _f.value;
|
|
321
|
-
pushRecord(entry);
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
325
|
-
finally {
|
|
326
|
-
try {
|
|
327
|
-
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
328
|
-
}
|
|
329
|
-
finally { if (e_6) throw e_6.error; }
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
334
|
-
finally {
|
|
335
|
-
try {
|
|
336
|
-
if (historySources_1_1 && !historySources_1_1.done && (_a = historySources_1.return)) _a.call(historySources_1);
|
|
337
|
-
}
|
|
338
|
-
finally { if (e_5) throw e_5.error; }
|
|
339
|
-
}
|
|
340
|
-
var fingerprintSources = [
|
|
341
|
-
job.aicoderV6FailureFingerprints,
|
|
342
|
-
job.aiCoderV6FailureFingerprints,
|
|
343
|
-
job.aicoder_v6_failure_fingerprints,
|
|
344
|
-
job.ai_coder_v6_failure_fingerprints,
|
|
345
|
-
job.workflowFailureFingerprints,
|
|
346
|
-
job.workflow_failure_fingerprints,
|
|
347
|
-
job.failureFingerprints,
|
|
348
|
-
job.failure_fingerprints,
|
|
349
|
-
app.aicoderV6FailureFingerprints,
|
|
350
|
-
app.aiCoderV6FailureFingerprints,
|
|
351
|
-
app.aicoder_v6_failure_fingerprints,
|
|
352
|
-
app.ai_coder_v6_failure_fingerprints,
|
|
353
|
-
evidence.aicoderV6FailureFingerprints,
|
|
354
|
-
evidence.aiCoderV6FailureFingerprints,
|
|
355
|
-
evidence.aicoder_v6_failure_fingerprints,
|
|
356
|
-
evidence.ai_coder_v6_failure_fingerprints,
|
|
357
|
-
evidence.workflowFailureFingerprints,
|
|
358
|
-
evidence.workflow_failure_fingerprints,
|
|
359
|
-
evidence.failureFingerprints,
|
|
360
|
-
evidence.failure_fingerprints
|
|
361
|
-
];
|
|
362
|
-
try {
|
|
363
|
-
for (var fingerprintSources_1 = __values(fingerprintSources), fingerprintSources_1_1 = fingerprintSources_1.next(); !fingerprintSources_1_1.done; fingerprintSources_1_1 = fingerprintSources_1.next()) {
|
|
364
|
-
var source = fingerprintSources_1_1.value;
|
|
365
|
-
try {
|
|
366
|
-
for (var _g = (e_8 = void 0, __values(asArray(source))), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
367
|
-
var entry = _h.value;
|
|
368
|
-
var fingerprint = plainObject(entry);
|
|
369
|
-
var count = Math.max(1, Math.min(8, Number(fingerprint.count || fingerprint.repeatedCount || fingerprint.repeated_count || 1) || 1));
|
|
370
|
-
var fallback = {
|
|
371
|
-
lane: cleanText(fingerprint.lane || 'aicoder', 80),
|
|
372
|
-
stepType: cleanText(fingerprint.stepType || fingerprint.step_type || 'workflow_step', 80),
|
|
373
|
-
outcome: cleanText(fingerprint.outcome || 'needs_repair', 80),
|
|
374
|
-
failureClass: cleanText(fingerprint.failureClass || fingerprint.failure_class || fingerprint.class, 120),
|
|
375
|
-
blocker: cleanText(fingerprint.blocker || fingerprint.reason || fingerprint.summary, 1200),
|
|
376
|
-
blockerFingerprint: cleanText(fingerprint.blockerFingerprint || fingerprint.blocker_fingerprint, 180),
|
|
377
|
-
evidenceHash: cleanText(fingerprint.evidenceHash || fingerprint.evidence_hash, 180)
|
|
378
|
-
};
|
|
379
|
-
for (var index = 0; index < count; index += 1) {
|
|
380
|
-
pushRecord(fingerprint, fallback);
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
385
|
-
finally {
|
|
386
|
-
try {
|
|
387
|
-
if (_h && !_h.done && (_d = _g.return)) _d.call(_g);
|
|
388
|
-
}
|
|
389
|
-
finally { if (e_8) throw e_8.error; }
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
394
|
-
finally {
|
|
395
|
-
try {
|
|
396
|
-
if (fingerprintSources_1_1 && !fingerprintSources_1_1.done && (_c = fingerprintSources_1.return)) _c.call(fingerprintSources_1);
|
|
397
|
-
}
|
|
398
|
-
finally { if (e_7) throw e_7.error; }
|
|
399
|
-
}
|
|
400
|
-
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);
|
|
401
|
-
pushRecord(currentFailure);
|
|
402
|
-
return records.slice(-80);
|
|
403
|
-
}
|
|
404
|
-
function aicoderManagerNoBlindLoopGate(app, job, evidence, now) {
|
|
405
|
-
return managerNoBlindLoopGateFromHistory(aicoderManagerFailureRecords(app, job, evidence), job.aicoderV6Budget
|
|
406
|
-
|| job.aiCoderV6Budget
|
|
407
|
-
|| job.aicoder_v6_budget
|
|
408
|
-
|| job.ai_coder_v6_budget
|
|
409
|
-
|| evidence.aicoderV6Budget
|
|
410
|
-
|| evidence.aiCoderV6Budget
|
|
411
|
-
|| evidence.aicoder_v6_budget
|
|
412
|
-
|| evidence.ai_coder_v6_budget
|
|
413
|
-
|| app.aicoderV6Budget
|
|
414
|
-
|| app.aiCoderV6Budget
|
|
415
|
-
|| app.aicoder_v6_budget
|
|
416
|
-
|| app.ai_coder_v6_budget
|
|
417
|
-
|| job.budget
|
|
418
|
-
|| evidence.budget, now);
|
|
419
|
-
}
|
|
420
|
-
function managerNoBlindLoopMetadata(gate) {
|
|
421
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
422
|
-
if (!gate) {
|
|
423
|
-
return undefined;
|
|
424
|
-
}
|
|
425
|
-
return {
|
|
426
|
-
action: cleanText((_a = gate.metadata) === null || _a === void 0 ? void 0 : _a.action, 120),
|
|
427
|
-
status: gate.status,
|
|
428
|
-
failureClass: cleanText((_b = gate.metadata) === null || _b === void 0 ? void 0 : _b.failureClass, 120),
|
|
429
|
-
sameFailureCount: Number(((_c = gate.metadata) === null || _c === void 0 ? void 0 : _c.sameFailureCount) || 0),
|
|
430
|
-
pingPongCount: Number(((_d = gate.metadata) === null || _d === void 0 ? void 0 : _d.pingPongCount) || 0),
|
|
431
|
-
newEvidence: ((_e = gate.metadata) === null || _e === void 0 ? void 0 : _e.newEvidence) === true,
|
|
432
|
-
materialEvidence: ((_f = gate.metadata) === null || _f === void 0 ? void 0 : _f.materialEvidence) === true,
|
|
433
|
-
evidenceStrength: cleanText((_g = gate.metadata) === null || _g === void 0 ? void 0 : _g.evidenceStrength, 120),
|
|
434
|
-
loopBudgetShouldReset: ((_h = gate.metadata) === null || _h === void 0 ? void 0 : _h.loopBudgetShouldReset) === true,
|
|
435
|
-
dispatchAction: cleanText((_j = gate.metadata) === null || _j === void 0 ? void 0 : _j.dispatchAction, 160),
|
|
436
|
-
productRepairAllowed: ((_k = gate.metadata) === null || _k === void 0 ? void 0 : _k.productRepairAllowed) === true,
|
|
437
|
-
expensiveModelAllowed: ((_l = gate.metadata) === null || _l === void 0 ? void 0 : _l.expensiveModelAllowed) === true,
|
|
438
|
-
productRepairFailure: ((_m = gate.metadata) === null || _m === void 0 ? void 0 : _m.productRepairFailure) === true,
|
|
439
|
-
requiresNewEvidence: ((_o = gate.metadata) === null || _o === void 0 ? void 0 : _o.requiresNewEvidence) === true
|
|
440
|
-
};
|
|
441
|
-
}
|
|
442
|
-
function hotfixEvidenceCandidates() {
|
|
443
|
-
var e_9, _a;
|
|
444
|
-
var sources = [];
|
|
445
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
446
|
-
sources[_i] = arguments[_i];
|
|
447
|
-
}
|
|
448
|
-
var result = [];
|
|
449
|
-
var seen = new Set();
|
|
450
|
-
var pushCandidate = function (value) {
|
|
451
|
-
var e_10, _a, e_11, _b;
|
|
452
|
-
var _c, _d;
|
|
453
|
-
if (Array.isArray(value)) {
|
|
454
|
-
try {
|
|
455
|
-
for (var value_1 = __values(value), value_1_1 = value_1.next(); !value_1_1.done; value_1_1 = value_1.next()) {
|
|
456
|
-
var entry = value_1_1.value;
|
|
457
|
-
pushCandidate(entry);
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
461
|
-
finally {
|
|
462
|
-
try {
|
|
463
|
-
if (value_1_1 && !value_1_1.done && (_a = value_1.return)) _a.call(value_1);
|
|
464
|
-
}
|
|
465
|
-
finally { if (e_10) throw e_10.error; }
|
|
466
|
-
}
|
|
467
|
-
return;
|
|
468
|
-
}
|
|
469
|
-
if (!value || typeof value !== 'object') {
|
|
470
|
-
return;
|
|
471
|
-
}
|
|
472
|
-
var nestedValues = [
|
|
473
|
-
value.hotfixEvidence,
|
|
474
|
-
value.hotfix_evidence,
|
|
475
|
-
value.releaseHotfixEvidence,
|
|
476
|
-
value.release_hotfix_evidence,
|
|
477
|
-
value.managerHotfixEvidence,
|
|
478
|
-
value.manager_hotfix_evidence,
|
|
479
|
-
value.backendHotfixEvidence,
|
|
480
|
-
value.backend_hotfix_evidence
|
|
481
|
-
].filter(Boolean);
|
|
482
|
-
if (nestedValues.length) {
|
|
483
|
-
try {
|
|
484
|
-
for (var nestedValues_1 = __values(nestedValues), nestedValues_1_1 = nestedValues_1.next(); !nestedValues_1_1.done; nestedValues_1_1 = nestedValues_1.next()) {
|
|
485
|
-
var nestedValue = nestedValues_1_1.value;
|
|
486
|
-
pushCandidate(nestedValue);
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
490
|
-
finally {
|
|
491
|
-
try {
|
|
492
|
-
if (nestedValues_1_1 && !nestedValues_1_1.done && (_b = nestedValues_1.return)) _b.call(nestedValues_1);
|
|
493
|
-
}
|
|
494
|
-
finally { if (e_11) throw e_11.error; }
|
|
495
|
-
}
|
|
496
|
-
return;
|
|
497
|
-
}
|
|
498
|
-
if (!(value.channel || value.hotfixChannel || value.hotfix_channel)) {
|
|
499
|
-
return;
|
|
500
|
-
}
|
|
501
|
-
var key = JSON.stringify({
|
|
502
|
-
channel: value.channel || value.hotfixChannel || value.hotfix_channel,
|
|
503
|
-
host: ((_c = value.target) === null || _c === void 0 ? void 0 : _c.host) || value.host,
|
|
504
|
-
path: ((_d = value.target) === null || _d === void 0 ? void 0 : _d.path) || value.path || value.remotePath || value.remote_path,
|
|
505
|
-
checksum: value.remoteChecksumAfter || value.remote_checksum_after || value.remoteChecksum || value.remote_checksum
|
|
506
|
-
});
|
|
507
|
-
if (seen.has(key)) {
|
|
508
|
-
return;
|
|
509
|
-
}
|
|
510
|
-
seen.add(key);
|
|
511
|
-
result.push(value);
|
|
512
|
-
};
|
|
513
|
-
try {
|
|
514
|
-
for (var sources_1 = __values(sources), sources_1_1 = sources_1.next(); !sources_1_1.done; sources_1_1 = sources_1.next()) {
|
|
515
|
-
var source = sources_1_1.value;
|
|
516
|
-
pushCandidate(source);
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
520
|
-
finally {
|
|
521
|
-
try {
|
|
522
|
-
if (sources_1_1 && !sources_1_1.done && (_a = sources_1.return)) _a.call(sources_1);
|
|
523
|
-
}
|
|
524
|
-
finally { if (e_9) throw e_9.error; }
|
|
525
|
-
}
|
|
526
|
-
return result;
|
|
527
|
-
}
|
|
528
|
-
function hotfixEvidenceArtifactPaths(evidence, normalized) {
|
|
529
|
-
var _a;
|
|
530
|
-
return [
|
|
531
|
-
normalized === null || normalized === void 0 ? void 0 : normalized.compiledArtifactPath,
|
|
532
|
-
normalized === null || normalized === void 0 ? void 0 : normalized.builtDistPath,
|
|
533
|
-
(_a = normalized === null || normalized === void 0 ? void 0 : normalized.target) === null || _a === void 0 ? void 0 : _a.artifactPath,
|
|
534
|
-
evidence.compiledArtifactPath,
|
|
535
|
-
evidence.compiled_artifact_path,
|
|
536
|
-
evidence.builtDistPath,
|
|
537
|
-
evidence.built_dist_path,
|
|
538
|
-
evidence.artifactPath,
|
|
539
|
-
evidence.artifact_path
|
|
540
|
-
].map(function (entry) { return cleanText(entry, 500); }).filter(Boolean).slice(0, 8);
|
|
541
|
-
}
|
|
542
|
-
function hotfixEvidenceGate(evidence, now) {
|
|
543
|
-
var _a, _b;
|
|
544
|
-
var validation = (0, ai_runner_manager_policy_1.validateResolveIOAIManagerHotfixEvidence)(evidence);
|
|
545
|
-
if (!validation.normalized && validation.status === 'missing') {
|
|
546
|
-
return undefined;
|
|
547
|
-
}
|
|
548
|
-
var status = validation.valid
|
|
549
|
-
? (validation.fullDeployAllowed ? 'warn' : 'pass')
|
|
550
|
-
: validation.status === 'blocked'
|
|
551
|
-
? 'blocked'
|
|
552
|
-
: 'fail';
|
|
553
|
-
var reason = validation.valid
|
|
554
|
-
? validation.fullDeployAllowed
|
|
555
|
-
? 'Hotfix evidence allows exactly one full deploy after force/new-artifact proof.'
|
|
556
|
-
: 'Hotfix evidence is sufficient; rerun the smallest release gate before continuing.'
|
|
557
|
-
: validation.blockers.join('; ');
|
|
558
|
-
return {
|
|
559
|
-
key: 'hotfix_evidence',
|
|
560
|
-
label: 'Hotfix evidence',
|
|
561
|
-
status: status,
|
|
562
|
-
reason: reason,
|
|
563
|
-
evidenceRefs: hotfixEvidenceArtifactPaths(evidence, validation.normalized),
|
|
564
|
-
recordedAt: isoNow(now || ((_a = validation.normalized) === null || _a === void 0 ? void 0 : _a.recordedAt)),
|
|
565
|
-
metadata: {
|
|
566
|
-
channel: validation.channel,
|
|
567
|
-
nextAction: validation.nextAction,
|
|
568
|
-
fullDeployAllowed: validation.fullDeployAllowed,
|
|
569
|
-
fullDeployBlocked: validation.fullDeployBlocked,
|
|
570
|
-
hotfixSatisfied: validation.hotfixSatisfied,
|
|
571
|
-
blockers: validation.blockers,
|
|
572
|
-
githubCommitGuard: validation.githubCommitGuard,
|
|
573
|
-
target: (_b = validation.normalized) === null || _b === void 0 ? void 0 : _b.target
|
|
574
|
-
}
|
|
575
|
-
};
|
|
576
|
-
}
|
|
577
|
-
function hotfixCommitProofGate(evidence, now) {
|
|
578
|
-
var _a;
|
|
579
|
-
var validation = (0, ai_runner_manager_policy_1.validateResolveIOAIManagerHotfixEvidence)(evidence);
|
|
580
|
-
var guard = validation.githubCommitGuard;
|
|
581
|
-
if (!guard.required) {
|
|
582
|
-
return undefined;
|
|
583
|
-
}
|
|
584
|
-
var status = guard.passed
|
|
585
|
-
? 'pass'
|
|
586
|
-
: guard.status === 'invalid'
|
|
587
|
-
? 'fail'
|
|
588
|
-
: 'blocked';
|
|
589
|
-
return {
|
|
590
|
-
key: 'hotfix_commit_proof',
|
|
591
|
-
label: 'Hotfix GitHub commit proof',
|
|
592
|
-
status: status,
|
|
593
|
-
reason: guard.passed
|
|
594
|
-
? 'Hotfix has matching sourceCommitSha, GitHub commit URL, and passed gitPushStatus/gitCommitStatus.'
|
|
595
|
-
: (guard.blockers.join('; ') || 'Manager hotfix is blocked until sourceCommitSha, githubCommitUrl, and passed gitPushStatus prove the hotfix is pushed to GitHub.'),
|
|
596
|
-
evidenceRefs: cleanStringList([guard.githubCommitUrl], 1, 500),
|
|
597
|
-
recordedAt: isoNow(now || ((_a = validation.normalized) === null || _a === void 0 ? void 0 : _a.recordedAt)),
|
|
598
|
-
metadata: {
|
|
599
|
-
channel: guard.channel || validation.channel,
|
|
600
|
-
status: guard.status,
|
|
601
|
-
passed: guard.passed,
|
|
602
|
-
managerMustCommitBeforeHotfix: guard.managerMustCommitBeforeHotfix,
|
|
603
|
-
sourceCommitSha: guard.sourceCommitSha,
|
|
604
|
-
githubCommitUrl: guard.githubCommitUrl,
|
|
605
|
-
githubCommitSha: guard.githubCommitSha,
|
|
606
|
-
gitCommitStatus: guard.gitCommitStatus,
|
|
607
|
-
gitPushStatus: guard.gitPushStatus,
|
|
608
|
-
blockers: guard.blockers,
|
|
609
|
-
nextCommands: guard.nextCommands,
|
|
610
|
-
requiredEvidence: guard.requiredEvidence
|
|
611
|
-
}
|
|
612
|
-
};
|
|
613
|
-
}
|
|
614
|
-
function collectHotfixEvidenceEvents(sources, events, gates, now) {
|
|
615
|
-
var e_12, _a;
|
|
616
|
-
var _b, _c;
|
|
617
|
-
try {
|
|
618
|
-
for (var _d = __values(hotfixEvidenceCandidates.apply(void 0, __spreadArray([], __read(sources), false))), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
619
|
-
var evidence = _e.value;
|
|
620
|
-
var validation = (0, ai_runner_manager_policy_1.validateResolveIOAIManagerHotfixEvidence)(evidence);
|
|
621
|
-
if (!validation.normalized && validation.status === 'missing') {
|
|
622
|
-
continue;
|
|
623
|
-
}
|
|
624
|
-
var artifactPaths = hotfixEvidenceArtifactPaths(evidence, validation.normalized);
|
|
625
|
-
pushEvent(events, {
|
|
626
|
-
type: 'hotfix',
|
|
627
|
-
category: validation.channel || 'hotfix',
|
|
628
|
-
message: validation.valid
|
|
629
|
-
? "Hotfix evidence recorded for ".concat(validation.channel, ".")
|
|
630
|
-
: "Incomplete hotfix evidence for ".concat(validation.channel || 'unknown channel', "."),
|
|
631
|
-
artifactPaths: artifactPaths,
|
|
632
|
-
recordedAt: ((_b = validation.normalized) === null || _b === void 0 ? void 0 : _b.recordedAt) || eventDate(evidence),
|
|
633
|
-
metadata: {
|
|
634
|
-
status: validation.status,
|
|
635
|
-
nextAction: validation.nextAction,
|
|
636
|
-
fullDeployAllowed: validation.fullDeployAllowed,
|
|
637
|
-
fullDeployBlocked: validation.fullDeployBlocked,
|
|
638
|
-
hotfixSatisfied: validation.hotfixSatisfied,
|
|
639
|
-
blockers: validation.blockers,
|
|
640
|
-
githubCommitGuard: validation.githubCommitGuard,
|
|
641
|
-
target: (_c = validation.normalized) === null || _c === void 0 ? void 0 : _c.target
|
|
642
|
-
}
|
|
643
|
-
});
|
|
644
|
-
var gate = hotfixEvidenceGate(evidence, now);
|
|
645
|
-
if (gate) {
|
|
646
|
-
gates.push(gate);
|
|
647
|
-
}
|
|
648
|
-
var commitProofGate = hotfixCommitProofGate(evidence, now);
|
|
649
|
-
if (commitProofGate) {
|
|
650
|
-
gates.push(commitProofGate);
|
|
651
|
-
pushEvent(events, {
|
|
652
|
-
type: 'log',
|
|
653
|
-
category: 'hotfix_commit_proof',
|
|
654
|
-
message: commitProofGate.reason,
|
|
655
|
-
artifactPaths: commitProofGate.evidenceRefs,
|
|
656
|
-
recordedAt: commitProofGate.recordedAt,
|
|
657
|
-
metadata: commitProofGate.metadata
|
|
658
|
-
});
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
663
|
-
finally {
|
|
664
|
-
try {
|
|
665
|
-
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
666
|
-
}
|
|
667
|
-
finally { if (e_12) throw e_12.error; }
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
function collectUsageEvents(entries, events) {
|
|
671
|
-
var e_13, _a;
|
|
672
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
673
|
-
if (!entries.length) {
|
|
674
|
-
return undefined;
|
|
675
|
-
}
|
|
676
|
-
var normalizedEntries = (0, ai_run_evidence_1.normalizeOpenAIUsageRowsForCosting)(entries);
|
|
677
|
-
try {
|
|
678
|
-
for (var normalizedEntries_1 = __values(normalizedEntries), normalizedEntries_1_1 = normalizedEntries_1.next(); !normalizedEntries_1_1.done; normalizedEntries_1_1 = normalizedEntries_1.next()) {
|
|
679
|
-
var entry = normalizedEntries_1_1.value;
|
|
680
|
-
pushEvent(events, {
|
|
681
|
-
type: 'usage',
|
|
682
|
-
category: cleanText(entry.category || entry.kind || entry.phase, 160) || 'usage',
|
|
683
|
-
message: cleanText(entry.summary || entry.description || entry.model || 'Model usage recorded.', 800),
|
|
684
|
-
recordedAt: eventDate(entry),
|
|
685
|
-
metadata: {
|
|
686
|
-
model: entry.model,
|
|
687
|
-
inputTokens: (_b = entry.inputTokens) !== null && _b !== void 0 ? _b : entry.input_tokens,
|
|
688
|
-
outputTokens: (_c = entry.outputTokens) !== null && _c !== void 0 ? _c : entry.output_tokens,
|
|
689
|
-
totalTokens: (_d = entry.totalTokens) !== null && _d !== void 0 ? _d : entry.total_tokens,
|
|
690
|
-
estimatedUsd: (_e = entry.estimatedUsd) !== null && _e !== void 0 ? _e : entry.cost_estimate,
|
|
691
|
-
usageSource: (_f = entry.usage_source) !== null && _f !== void 0 ? _f : entry.usageSource,
|
|
692
|
-
usageSurface: (_g = entry.usage_surface) !== null && _g !== void 0 ? _g : entry.usageSurface,
|
|
693
|
-
usagePhase: (_h = entry.usage_phase) !== null && _h !== void 0 ? _h : entry.usagePhase,
|
|
694
|
-
costBasis: (_j = entry.cost_basis) !== null && _j !== void 0 ? _j : entry.costBasis,
|
|
695
|
-
isManual: (_k = entry.is_manual) !== null && _k !== void 0 ? _k : entry.isManual,
|
|
696
|
-
isUntracked: (_l = entry.is_untracked) !== null && _l !== void 0 ? _l : entry.isUntracked,
|
|
697
|
-
untrackedReason: (_m = entry.untracked_reason) !== null && _m !== void 0 ? _m : entry.untrackedReason
|
|
698
|
-
}
|
|
699
|
-
});
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
catch (e_13_1) { e_13 = { error: e_13_1 }; }
|
|
703
|
-
finally {
|
|
704
|
-
try {
|
|
705
|
-
if (normalizedEntries_1_1 && !normalizedEntries_1_1.done && (_a = normalizedEntries_1.return)) _a.call(normalizedEntries_1);
|
|
706
|
-
}
|
|
707
|
-
finally { if (e_13) throw e_13.error; }
|
|
708
|
-
}
|
|
709
|
-
return (0, ai_run_evidence_1.buildAIRunCost)(entries);
|
|
710
|
-
}
|
|
711
|
-
function collectCommitEvents(commits, events) {
|
|
712
|
-
var e_14, _a;
|
|
713
|
-
try {
|
|
714
|
-
for (var _b = __values(commits.slice(0, 80)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
715
|
-
var commit = _c.value;
|
|
716
|
-
pushEvent(events, {
|
|
717
|
-
type: 'git_commit',
|
|
718
|
-
message: cleanText(commit.message || commit.subject || commit.title || commit.hash || commit.sha, 1200),
|
|
719
|
-
recordedAt: eventDate(commit),
|
|
720
|
-
metadata: {
|
|
721
|
-
sha: commit.sha || commit.hash,
|
|
722
|
-
branch: commit.branch,
|
|
723
|
-
author: commit.author
|
|
724
|
-
}
|
|
725
|
-
});
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
catch (e_14_1) { e_14 = { error: e_14_1 }; }
|
|
729
|
-
finally {
|
|
730
|
-
try {
|
|
731
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
732
|
-
}
|
|
733
|
-
finally { if (e_14) throw e_14.error; }
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
function statusFromBoolean(value, fallback) {
|
|
737
|
-
if (value === true) {
|
|
738
|
-
return 'pass';
|
|
739
|
-
}
|
|
740
|
-
if (value === false) {
|
|
741
|
-
return 'fail';
|
|
742
|
-
}
|
|
743
|
-
return fallback;
|
|
744
|
-
}
|
|
745
|
-
function collectArtifacts(evidence) {
|
|
746
|
-
var e_15, _a, e_16, _b, e_17, _c;
|
|
747
|
-
var artifacts = [];
|
|
748
|
-
try {
|
|
749
|
-
for (var _d = __values(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.artifacts)), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
750
|
-
var entry = _e.value;
|
|
751
|
-
artifacts.push({
|
|
752
|
-
type: entry.type || 'other',
|
|
753
|
-
path: cleanText(entry.path || entry.file || entry.artifactPath, 500),
|
|
754
|
-
url: cleanText(entry.url, 500),
|
|
755
|
-
title: cleanText(entry.title || entry.name, 300),
|
|
756
|
-
caption: cleanText(entry.caption || entry.message, 800),
|
|
757
|
-
metadata: entry.metadata
|
|
758
|
-
});
|
|
759
|
-
}
|
|
760
|
-
}
|
|
761
|
-
catch (e_15_1) { e_15 = { error: e_15_1 }; }
|
|
762
|
-
finally {
|
|
763
|
-
try {
|
|
764
|
-
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
765
|
-
}
|
|
766
|
-
finally { if (e_15) throw e_15.error; }
|
|
767
|
-
}
|
|
768
|
-
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));
|
|
769
|
-
try {
|
|
770
|
-
for (var _f = __values(screenshots.slice(0, 40)), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
771
|
-
var screenshot = _g.value;
|
|
772
|
-
if (typeof screenshot === 'string') {
|
|
773
|
-
artifacts.push({ type: 'screenshot', path: screenshot });
|
|
774
|
-
}
|
|
775
|
-
else {
|
|
776
|
-
artifacts.push({
|
|
777
|
-
type: 'screenshot',
|
|
778
|
-
path: cleanText(screenshot.path || screenshot.file, 500),
|
|
779
|
-
url: cleanText(screenshot.url, 500),
|
|
780
|
-
title: cleanText(screenshot.title || screenshot.route, 300),
|
|
781
|
-
caption: cleanText(screenshot.caption || screenshot.message, 800),
|
|
782
|
-
metadata: screenshot.metadata
|
|
783
|
-
});
|
|
784
|
-
}
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
catch (e_16_1) { e_16 = { error: e_16_1 }; }
|
|
788
|
-
finally {
|
|
789
|
-
try {
|
|
790
|
-
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
791
|
-
}
|
|
792
|
-
finally { if (e_16) throw e_16.error; }
|
|
793
|
-
}
|
|
794
|
-
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);
|
|
795
|
-
try {
|
|
796
|
-
for (var _h = __values(artifactRefs.slice(0, 60)), _j = _h.next(); !_j.done; _j = _h.next()) {
|
|
797
|
-
var entry = _j.value;
|
|
798
|
-
if (typeof entry === 'string') {
|
|
799
|
-
artifacts.push({ type: 'other', path: cleanText(entry, 500) });
|
|
800
|
-
}
|
|
801
|
-
else if (entry && typeof entry === 'object') {
|
|
802
|
-
artifacts.push({
|
|
803
|
-
type: entry.type || 'other',
|
|
804
|
-
path: cleanText(entry.path || entry.file || entry.artifactPath || entry.artifact_path, 500),
|
|
805
|
-
url: cleanText(entry.url, 500),
|
|
806
|
-
title: cleanText(entry.title || entry.name || entry.label, 300),
|
|
807
|
-
caption: cleanText(entry.caption || entry.message || entry.summary, 800),
|
|
808
|
-
metadata: entry.metadata
|
|
809
|
-
});
|
|
810
|
-
}
|
|
811
|
-
}
|
|
812
|
-
}
|
|
813
|
-
catch (e_17_1) { e_17 = { error: e_17_1 }; }
|
|
814
|
-
finally {
|
|
815
|
-
try {
|
|
816
|
-
if (_j && !_j.done && (_c = _h.return)) _c.call(_h);
|
|
817
|
-
}
|
|
818
|
-
finally { if (e_17) throw e_17.error; }
|
|
819
|
-
}
|
|
820
|
-
return artifacts;
|
|
821
|
-
}
|
|
822
|
-
function collectInfraChecks(evidence) {
|
|
823
|
-
var e_18, _a;
|
|
824
|
-
var _b;
|
|
825
|
-
var checks = [];
|
|
826
|
-
try {
|
|
827
|
-
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()) {
|
|
828
|
-
var entry = _d.value;
|
|
829
|
-
checks.push({
|
|
830
|
-
name: cleanText(entry.name || entry.check || entry.key, 160) || 'infra_check',
|
|
831
|
-
status: entry.status || statusFromBoolean(entry.passed),
|
|
832
|
-
message: cleanText(entry.message || entry.error || entry.reason, 1000),
|
|
833
|
-
path: cleanText(entry.path, 500),
|
|
834
|
-
durationMs: Number((_b = entry.durationMs) !== null && _b !== void 0 ? _b : entry.duration_ms) || undefined,
|
|
835
|
-
metadata: entry.metadata,
|
|
836
|
-
checkedAt: eventDate(entry)
|
|
837
|
-
});
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
catch (e_18_1) { e_18 = { error: e_18_1 }; }
|
|
841
|
-
finally {
|
|
842
|
-
try {
|
|
843
|
-
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
844
|
-
}
|
|
845
|
-
finally { if (e_18) throw e_18.error; }
|
|
846
|
-
}
|
|
847
|
-
if (evidence === null || evidence === void 0 ? void 0 : evidence.preflightStatus) {
|
|
848
|
-
checks.push({
|
|
849
|
-
name: 'qa_preflight',
|
|
850
|
-
status: evidence.preflightStatus,
|
|
851
|
-
message: cleanText(evidence.preflightMessage || evidence.preflightReason, 1000),
|
|
852
|
-
path: cleanText(evidence.preflightArtifactPath || evidence.preflightPath, 500)
|
|
853
|
-
});
|
|
854
|
-
}
|
|
855
|
-
return checks;
|
|
856
|
-
}
|
|
857
|
-
function collectCompileResult(evidence) {
|
|
858
|
-
var _a, _b, _c;
|
|
859
|
-
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);
|
|
860
|
-
if (!build && (evidence === null || evidence === void 0 ? void 0 : evidence.compileStatus) === undefined && (evidence === null || evidence === void 0 ? void 0 : evidence.buildStatus) === undefined) {
|
|
861
|
-
return undefined;
|
|
862
|
-
}
|
|
863
|
-
var status = (build === null || build === void 0 ? void 0 : build.status)
|
|
864
|
-
|| (evidence === null || evidence === void 0 ? void 0 : evidence.compileStatus)
|
|
865
|
-
|| (evidence === null || evidence === void 0 ? void 0 : evidence.buildStatus)
|
|
866
|
-
|| 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);
|
|
867
|
-
return {
|
|
868
|
-
status: status,
|
|
869
|
-
command: cleanText((build === null || build === void 0 ? void 0 : build.command) || (evidence === null || evidence === void 0 ? void 0 : evidence.buildCommand), 500),
|
|
870
|
-
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),
|
|
871
|
-
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),
|
|
872
|
-
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,
|
|
873
|
-
staleEvidence: (build === null || build === void 0 ? void 0 : build.staleEvidence) === true || (evidence === null || evidence === void 0 ? void 0 : evidence.staleBuildEvidence) === true,
|
|
874
|
-
recordedAt: eventDate(build || evidence || {})
|
|
875
|
-
};
|
|
876
|
-
}
|
|
877
|
-
function collectRouteProbes(evidence) {
|
|
878
|
-
var e_19, _a, e_20, _b;
|
|
879
|
-
var probes = [];
|
|
880
|
-
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);
|
|
881
|
-
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));
|
|
882
|
-
if (Object.keys(directProbe).length) {
|
|
883
|
-
rows.push(directProbe);
|
|
884
|
-
}
|
|
885
|
-
try {
|
|
886
|
-
for (var rows_1 = __values(rows), rows_1_1 = rows_1.next(); !rows_1_1.done; rows_1_1 = rows_1.next()) {
|
|
887
|
-
var entry = rows_1_1.value;
|
|
888
|
-
probes.push({
|
|
889
|
-
route: cleanText(entry.route || entry.path || entry.url, 500) || '/',
|
|
890
|
-
status: entry.status || statusFromBoolean(entry.passed),
|
|
891
|
-
screenshot: cleanText(entry.screenshot || entry.screenshotPath, 500),
|
|
892
|
-
caption: cleanText(entry.caption || entry.message, 1000),
|
|
893
|
-
shellOnly: entry.shellOnly === true,
|
|
894
|
-
authenticated: entry.authenticated === true,
|
|
895
|
-
consoleErrors: asArray(entry.consoleErrors),
|
|
896
|
-
networkErrors: asArray(entry.networkErrors),
|
|
897
|
-
message: cleanText(entry.message || entry.error, 1000),
|
|
898
|
-
recordedAt: eventDate(entry)
|
|
899
|
-
});
|
|
900
|
-
}
|
|
901
|
-
}
|
|
902
|
-
catch (e_19_1) { e_19 = { error: e_19_1 }; }
|
|
903
|
-
finally {
|
|
904
|
-
try {
|
|
905
|
-
if (rows_1_1 && !rows_1_1.done && (_a = rows_1.return)) _a.call(rows_1);
|
|
906
|
-
}
|
|
907
|
-
finally { if (e_19) throw e_19.error; }
|
|
908
|
-
}
|
|
909
|
-
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));
|
|
910
|
-
try {
|
|
911
|
-
for (var _c = __values(screenshots.slice(0, 20)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
912
|
-
var screenshot = _d.value;
|
|
913
|
-
if (typeof screenshot === 'string') {
|
|
914
|
-
probes.push({ route: '/', status: 'pass', screenshot: screenshot, caption: 'Historical browser screenshot recorded.' });
|
|
915
|
-
}
|
|
916
|
-
else if (screenshot.route || screenshot.path || screenshot.url || screenshot.screenshot || screenshot.file) {
|
|
917
|
-
probes.push({
|
|
918
|
-
route: cleanText(screenshot.route || screenshot.url || screenshot.path, 500) || '/',
|
|
919
|
-
status: screenshot.status || statusFromBoolean(screenshot.passed, 'pass'),
|
|
920
|
-
screenshot: cleanText(screenshot.screenshot || screenshot.screenshotPath || screenshot.file || screenshot.path, 500),
|
|
921
|
-
caption: cleanText(screenshot.caption || screenshot.message, 1000),
|
|
922
|
-
shellOnly: screenshot.shellOnly === true,
|
|
923
|
-
authenticated: screenshot.authenticated === true,
|
|
924
|
-
recordedAt: eventDate(screenshot)
|
|
925
|
-
});
|
|
926
|
-
}
|
|
927
|
-
}
|
|
928
|
-
}
|
|
929
|
-
catch (e_20_1) { e_20 = { error: e_20_1 }; }
|
|
930
|
-
finally {
|
|
931
|
-
try {
|
|
932
|
-
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
933
|
-
}
|
|
934
|
-
finally { if (e_20) throw e_20.error; }
|
|
935
|
-
}
|
|
936
|
-
return probes;
|
|
937
|
-
}
|
|
938
|
-
function collectBusinessAssertions(evidence) {
|
|
939
|
-
var e_21, _a;
|
|
940
|
-
var assertions = [];
|
|
941
|
-
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);
|
|
942
|
-
try {
|
|
943
|
-
for (var rows_2 = __values(rows), rows_2_1 = rows_2.next(); !rows_2_1.done; rows_2_1 = rows_2.next()) {
|
|
944
|
-
var entry = rows_2_1.value;
|
|
945
|
-
assertions.push({
|
|
946
|
-
assertion: cleanText(entry.assertion || entry.name || entry.label || entry.workflow || entry.expected, 1000) || 'business assertion',
|
|
947
|
-
status: entry.status || entry.outcome || entry.result || statusFromBoolean(entry.passed),
|
|
948
|
-
workflow: cleanText(entry.workflow || entry.workflowName || entry.workflow_name, 400),
|
|
949
|
-
route: cleanText(entry.route || entry.url, 500),
|
|
950
|
-
action: cleanText(entry.action || entry.action_under_test || entry.actionUnderTest, 500),
|
|
951
|
-
expected: cleanText(entry.expected || entry.expected_business_state_change || entry.expectedBusinessStateChange, 1000),
|
|
952
|
-
observed: cleanText(entry.observed || entry.actual || entry.after || entry.after_state || entry.afterState, 1000),
|
|
953
|
-
dataProof: cleanText(entry.dataProof || entry.data_proof || entry.domProof || entry.dom_proof || entry.proof || entry.summary, 1400),
|
|
954
|
-
mongoDelta: plainObject(entry.mongoDelta || entry.mongo_delta),
|
|
955
|
-
artifactPaths: cleanStringList(entry.artifactPaths || entry.artifact_paths || entry.artifacts || entry.screenshots || (entry.screenshot ? [entry.screenshot] : []), 30, 500),
|
|
956
|
-
message: cleanText(entry.message || entry.error || entry.reason, 1000),
|
|
957
|
-
recordedAt: eventDate(entry),
|
|
958
|
-
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 } : {}))
|
|
959
|
-
});
|
|
960
|
-
}
|
|
961
|
-
}
|
|
962
|
-
catch (e_21_1) { e_21 = { error: e_21_1 }; }
|
|
963
|
-
finally {
|
|
964
|
-
try {
|
|
965
|
-
if (rows_2_1 && !rows_2_1.done && (_a = rows_2.return)) _a.call(rows_2);
|
|
966
|
-
}
|
|
967
|
-
finally { if (e_21) throw e_21.error; }
|
|
968
|
-
}
|
|
969
|
-
if (!assertions.length && (evidence === null || evidence === void 0 ? void 0 : evidence.qaRunOutcome) === 'business_assertion_passed') {
|
|
970
|
-
assertions.push({
|
|
971
|
-
assertion: cleanText(evidence.aiRunOutcomeReason || evidence.reason || 'Historical business assertion passed.', 1000),
|
|
972
|
-
status: 'pass',
|
|
973
|
-
dataProof: cleanText(evidence.aiRunOutcomeReason || evidence.reason, 1400)
|
|
974
|
-
});
|
|
975
|
-
}
|
|
976
|
-
if (!assertions.length && (evidence === null || evidence === void 0 ? void 0 : evidence.qaRunOutcome) === 'business_assertion_failed') {
|
|
977
|
-
assertions.push({
|
|
978
|
-
assertion: cleanText(evidence.aiRunOutcomeReason || evidence.reason || 'Historical business assertion failed.', 1000),
|
|
979
|
-
status: 'fail',
|
|
980
|
-
observed: cleanText(evidence.aiRunOutcomeReason || evidence.reason, 1000)
|
|
981
|
-
});
|
|
982
|
-
}
|
|
983
|
-
return assertions;
|
|
984
|
-
}
|
|
985
|
-
function buildQaFromEvidence(evidence, now) {
|
|
986
|
-
return (0, ai_run_evidence_1.buildAIQaRun)({
|
|
987
|
-
infraChecks: collectInfraChecks(evidence),
|
|
988
|
-
compile: collectCompileResult(evidence),
|
|
989
|
-
routeProbes: collectRouteProbes(evidence),
|
|
990
|
-
businessAssertions: collectBusinessAssertions(evidence),
|
|
991
|
-
artifacts: collectArtifacts(evidence),
|
|
992
|
-
now: now
|
|
993
|
-
});
|
|
994
|
-
}
|
|
995
|
-
function isoNow(value) {
|
|
996
|
-
if (value instanceof Date) {
|
|
997
|
-
return value.toISOString();
|
|
998
|
-
}
|
|
999
|
-
if (value) {
|
|
1000
|
-
var parsed = new Date(value);
|
|
1001
|
-
if (!Number.isNaN(parsed.getTime())) {
|
|
1002
|
-
return parsed.toISOString();
|
|
1003
|
-
}
|
|
1004
|
-
}
|
|
1005
|
-
return new Date().toISOString();
|
|
1006
|
-
}
|
|
1007
|
-
function normalizeMatchText(value) {
|
|
1008
|
-
return cleanText(value, 3000)
|
|
1009
|
-
.toLowerCase()
|
|
1010
|
-
.replace(/[^a-z0-9]+/g, ' ')
|
|
1011
|
-
.replace(/\s+/g, ' ')
|
|
1012
|
-
.trim();
|
|
1013
|
-
}
|
|
1014
|
-
function importantTokens(value) {
|
|
1015
|
-
var stopWords = new Set([
|
|
1016
|
-
'the', 'and', 'that', 'with', 'from', 'after', 'before', 'when', 'then', 'this', 'must',
|
|
1017
|
-
'should', 'will', 'only', 'into', 'have', 'has', 'are', 'was', 'were', 'been'
|
|
1018
|
-
]);
|
|
1019
|
-
return new Set(normalizeMatchText(value).split(' ')
|
|
1020
|
-
.filter(function (token) { return token.length >= 4 && !stopWords.has(token); }));
|
|
1021
|
-
}
|
|
1022
|
-
function businessAssertionPassed(assertion) {
|
|
1023
|
-
return /^(pass|passed|success|ok|done)$/i.test(cleanText(assertion.status, 40));
|
|
1024
|
-
}
|
|
1025
|
-
function supportAssertionMatchesDiagnosisProof(assertion, proofPlan) {
|
|
1026
|
-
var e_22, _a;
|
|
1027
|
-
var metadata = assertion.metadata || {};
|
|
1028
|
-
if (metadata.diagnosisProofPlanMatched === true || metadata.proofPlanMatched === true || metadata.supportDiagnosisProof === true) {
|
|
1029
|
-
return true;
|
|
1030
|
-
}
|
|
1031
|
-
var requiredBusinessAssertion = proofPlan.business_assertion || proofPlan.businessAssertion;
|
|
1032
|
-
var proofParts = [
|
|
1033
|
-
requiredBusinessAssertion,
|
|
1034
|
-
proofPlan.after,
|
|
1035
|
-
proofPlan.data_assertion || proofPlan.dataAssertion,
|
|
1036
|
-
proofPlan.artifact_expectation || proofPlan.artifactExpectation
|
|
1037
|
-
].map(function (part) { return normalizeMatchText(part); }).filter(function (part) { return part.length >= 16; });
|
|
1038
|
-
if (!proofParts.length) {
|
|
1039
|
-
return true;
|
|
1040
|
-
}
|
|
1041
|
-
var assertionText = normalizeMatchText([
|
|
1042
|
-
assertion.assertion,
|
|
1043
|
-
assertion.workflow,
|
|
1044
|
-
assertion.action,
|
|
1045
|
-
assertion.expected,
|
|
1046
|
-
assertion.observed,
|
|
1047
|
-
assertion.dataProof,
|
|
1048
|
-
assertion.message
|
|
1049
|
-
].filter(Boolean).join(' '));
|
|
1050
|
-
if (proofParts.some(function (part) { return assertionText.includes(part); })) {
|
|
1051
|
-
return true;
|
|
1052
|
-
}
|
|
1053
|
-
var proofTokens = importantTokens([
|
|
1054
|
-
requiredBusinessAssertion,
|
|
1055
|
-
proofPlan.after,
|
|
1056
|
-
proofPlan.data_assertion || proofPlan.dataAssertion
|
|
1057
|
-
].filter(Boolean).join(' '));
|
|
1058
|
-
var assertionTokens = importantTokens(assertionText);
|
|
1059
|
-
if (!proofTokens.size) {
|
|
1060
|
-
return true;
|
|
1061
|
-
}
|
|
1062
|
-
var overlap = 0;
|
|
1063
|
-
try {
|
|
1064
|
-
for (var proofTokens_1 = __values(proofTokens), proofTokens_1_1 = proofTokens_1.next(); !proofTokens_1_1.done; proofTokens_1_1 = proofTokens_1.next()) {
|
|
1065
|
-
var token = proofTokens_1_1.value;
|
|
1066
|
-
if (assertionTokens.has(token)) {
|
|
1067
|
-
overlap += 1;
|
|
1068
|
-
}
|
|
1069
|
-
}
|
|
1070
|
-
}
|
|
1071
|
-
catch (e_22_1) { e_22 = { error: e_22_1 }; }
|
|
1072
|
-
finally {
|
|
1073
|
-
try {
|
|
1074
|
-
if (proofTokens_1_1 && !proofTokens_1_1.done && (_a = proofTokens_1.return)) _a.call(proofTokens_1);
|
|
1075
|
-
}
|
|
1076
|
-
finally { if (e_22) throw e_22.error; }
|
|
1077
|
-
}
|
|
1078
|
-
return overlap >= Math.min(4, Math.max(3, Math.ceil(proofTokens.size * 0.45)));
|
|
1079
|
-
}
|
|
1080
|
-
function supportDiagnosisProofGateResult(diagnosisGate, now) {
|
|
1081
|
-
var proofPlan = diagnosisGate.proof_plan || diagnosisGate.proofPlan || {};
|
|
1082
|
-
return {
|
|
1083
|
-
key: 'support_diagnosis_business_proof',
|
|
1084
|
-
label: 'Diagnosis proof plan',
|
|
1085
|
-
status: 'blocked',
|
|
1086
|
-
reason: 'Support business assertion did not map to the diagnosis proof_plan. Route proof or generic workflow proof cannot accept the ticket.',
|
|
1087
|
-
evidenceRefs: [],
|
|
1088
|
-
recordedAt: isoNow(now),
|
|
1089
|
-
metadata: {
|
|
1090
|
-
issueClass: cleanText(diagnosisGate.issue_class || diagnosisGate.issueClass, 120),
|
|
1091
|
-
requiredBusinessAssertion: cleanText(proofPlan.business_assertion || proofPlan.businessAssertion, 1000),
|
|
1092
|
-
requiredAfter: cleanText(proofPlan.after, 1000),
|
|
1093
|
-
requiredDataAssertion: cleanText(proofPlan.data_assertion || proofPlan.dataAssertion, 1000)
|
|
1094
|
-
}
|
|
1095
|
-
};
|
|
1096
|
-
}
|
|
1097
|
-
var SUPPORT_ROOT_CAUSE_ENTRY_REQUIRED_FIELDS = [
|
|
1098
|
-
'issue_case',
|
|
1099
|
-
'issue_class',
|
|
1100
|
-
'accepted_hypothesis',
|
|
1101
|
-
'rejected_alternatives',
|
|
1102
|
-
'failing_path',
|
|
1103
|
-
'owner_files',
|
|
1104
|
-
'proof_plan',
|
|
1105
|
-
'evidence'
|
|
1106
|
-
];
|
|
1107
|
-
var SUPPORT_ROOT_CAUSE_ENTRY_ISSUE_CLASSES = [
|
|
1108
|
-
'no_op_submit',
|
|
1109
|
-
'missing_wrong_data',
|
|
1110
|
-
'filter_query_mismatch',
|
|
1111
|
-
'invoice_pdf_export',
|
|
1112
|
-
'upload_import',
|
|
1113
|
-
'route_auth_hydration',
|
|
1114
|
-
'slow_query_performance'
|
|
1115
|
-
];
|
|
1116
|
-
function supportRootCauseEntryContractGate(contract, now) {
|
|
1117
|
-
if (!contract || !Object.keys(contract).length) {
|
|
1118
|
-
return undefined;
|
|
1119
|
-
}
|
|
1120
|
-
var requiredOutput = plainObject(contract.required_output || contract.requiredOutput);
|
|
1121
|
-
var ownerPolicy = plainObject(contract.owner_file_policy || contract.ownerFilePolicy);
|
|
1122
|
-
var businessProofPolicy = plainObject(contract.business_proof_policy || contract.businessProofPolicy);
|
|
1123
|
-
var failurePolicy = plainObject(contract.failure_policy || contract.failurePolicy);
|
|
1124
|
-
var probes = asArray(contract.issue_class_probes || contract.issueClassProbes);
|
|
1125
|
-
var requiredFields = cleanStringList(requiredOutput.required_fields || requiredOutput.requiredFields, 30, 160);
|
|
1126
|
-
var issueClasses = probes.map(function (probe) { return cleanText(probe.issue_class || probe.issueClass, 120); }).filter(Boolean);
|
|
1127
|
-
var missingRequiredFields = SUPPORT_ROOT_CAUSE_ENTRY_REQUIRED_FIELDS.filter(function (field) { return !requiredFields.includes(field); });
|
|
1128
|
-
var missingIssueClasses = SUPPORT_ROOT_CAUSE_ENTRY_ISSUE_CLASSES.filter(function (issueClass) { return !issueClasses.includes(issueClass); });
|
|
1129
|
-
var blockers = [];
|
|
1130
|
-
if (!cleanText(contract.contract_id || contract.contractId, 160)) {
|
|
1131
|
-
blockers.push('Root-cause entry contract is missing contract_id.');
|
|
1132
|
-
}
|
|
1133
|
-
if (cleanText(requiredOutput.object_key || requiredOutput.objectKey, 120) !== 'support_diagnosis_gate') {
|
|
1134
|
-
blockers.push('Root-cause entry contract must require support_diagnosis_gate output.');
|
|
1135
|
-
}
|
|
1136
|
-
if (missingRequiredFields.length) {
|
|
1137
|
-
blockers.push("Root-cause entry contract missing required output fields: ".concat(missingRequiredFields.join(', '), "."));
|
|
1138
|
-
}
|
|
1139
|
-
var ownerFileMax = Number(ownerPolicy.max_files || ownerPolicy.maxFiles || 0);
|
|
1140
|
-
if (!Number.isFinite(ownerFileMax) || ownerFileMax <= 0 || ownerFileMax > 12) {
|
|
1141
|
-
blockers.push('Root-cause entry contract must cap owner_files to a small exact file set.');
|
|
1142
|
-
}
|
|
1143
|
-
if (ownerPolicy.edits_outside_owner_files_require_revised_diagnosis !== true && ownerPolicy.editsOutsideOwnerFilesRequireRevisedDiagnosis !== true) {
|
|
1144
|
-
blockers.push('Root-cause entry contract must require revised diagnosis before edits outside owner_files.');
|
|
1145
|
-
}
|
|
1146
|
-
if (businessProofPolicy.requires_aiqa_business_assertion !== true && businessProofPolicy.requiresAiqaBusinessAssertion !== true) {
|
|
1147
|
-
blockers.push('Root-cause entry contract must require AIQaBusinessAssertion business proof.');
|
|
1148
|
-
}
|
|
1149
|
-
if (businessProofPolicy.route_load_screenshot_scorecard_model_claim_not_acceptance !== true && businessProofPolicy.routeLoadScreenshotScorecardModelClaimNotAcceptance !== true) {
|
|
1150
|
-
blockers.push('Root-cause entry contract must reject route-load/screenshot/scorecard/model-claim acceptance.');
|
|
1151
|
-
}
|
|
1152
|
-
if (failurePolicy.repeated_failure_without_new_evidence_parks_run !== true && failurePolicy.repeatedFailureWithoutNewEvidenceParksRun !== true) {
|
|
1153
|
-
blockers.push('Root-cause entry contract must park repeated failures without new evidence.');
|
|
1154
|
-
}
|
|
1155
|
-
if (missingIssueClasses.length) {
|
|
1156
|
-
blockers.push("Root-cause entry contract missing issue-class probes: ".concat(missingIssueClasses.join(', '), "."));
|
|
1157
|
-
}
|
|
1158
|
-
var status = blockers.length ? 'fail' : 'pass';
|
|
1159
|
-
return {
|
|
1160
|
-
key: 'support_root_cause_entry_contract',
|
|
1161
|
-
label: 'Root-cause entry contract',
|
|
1162
|
-
status: status,
|
|
1163
|
-
reason: blockers.length
|
|
1164
|
-
? blockers.join(' ')
|
|
1165
|
-
: 'Support run has a structured root-cause-first entry contract with issue-class probes, owner-file policy, and business-proof policy.',
|
|
1166
|
-
evidenceRefs: cleanStringList(businessProofPolicy.required_artifacts || businessProofPolicy.requiredArtifacts, 20, 500),
|
|
1167
|
-
recordedAt: isoNow(now),
|
|
1168
|
-
metadata: {
|
|
1169
|
-
contractId: cleanText(contract.contract_id || contract.contractId, 160),
|
|
1170
|
-
version: cleanText(contract.version, 120),
|
|
1171
|
-
status: cleanText(contract.status, 120),
|
|
1172
|
-
requiredOutputKey: cleanText(requiredOutput.object_key || requiredOutput.objectKey, 120),
|
|
1173
|
-
requiredFields: requiredFields,
|
|
1174
|
-
missingRequiredFields: missingRequiredFields,
|
|
1175
|
-
ownerFileMax: ownerFileMax,
|
|
1176
|
-
requiresRevisedDiagnosisForOutOfScopeEdits: ownerPolicy.edits_outside_owner_files_require_revised_diagnosis === true || ownerPolicy.editsOutsideOwnerFilesRequireRevisedDiagnosis === true,
|
|
1177
|
-
requiresBusinessAssertion: businessProofPolicy.requires_aiqa_business_assertion === true || businessProofPolicy.requiresAiqaBusinessAssertion === true,
|
|
1178
|
-
routeOnlyAcceptanceRejected: businessProofPolicy.route_load_screenshot_scorecard_model_claim_not_acceptance === true || businessProofPolicy.routeLoadScreenshotScorecardModelClaimNotAcceptance === true,
|
|
1179
|
-
issueClassProbeCount: issueClasses.length,
|
|
1180
|
-
issueClasses: issueClasses,
|
|
1181
|
-
missingIssueClasses: missingIssueClasses
|
|
1182
|
-
}
|
|
1183
|
-
};
|
|
1184
|
-
}
|
|
1185
|
-
function applySupportDiagnosisProofGate(qa, diagnosisGate, now) {
|
|
1186
|
-
var proofPlan = diagnosisGate.proof_plan || diagnosisGate.proofPlan || {};
|
|
1187
|
-
var requiredBusinessAssertion = cleanText(proofPlan.business_assertion || proofPlan.businessAssertion, 1000);
|
|
1188
|
-
var requiredAfter = cleanText(proofPlan.after, 1000);
|
|
1189
|
-
if (!Object.keys(proofPlan).length || (!requiredBusinessAssertion && !requiredAfter)) {
|
|
1190
|
-
return qa;
|
|
1191
|
-
}
|
|
1192
|
-
var passedAssertions = qa.businessAssertions.filter(businessAssertionPassed);
|
|
1193
|
-
if (!passedAssertions.length) {
|
|
1194
|
-
return qa;
|
|
1195
|
-
}
|
|
1196
|
-
if (passedAssertions.some(function (assertion) { return supportAssertionMatchesDiagnosisProof(assertion, proofPlan); })) {
|
|
1197
|
-
return qa;
|
|
1198
|
-
}
|
|
1199
|
-
var gate = supportDiagnosisProofGateResult(diagnosisGate, now);
|
|
1200
|
-
return __assign(__assign({}, qa), { outcome: qa.routeProbes.some(function (probe) { return /^(pass|passed|success|ok|done)$/i.test(cleanText(probe.status, 40)); })
|
|
1201
|
-
? 'route_only_pass'
|
|
1202
|
-
: 'incomplete', gateResults: __spreadArray(__spreadArray([], __read(qa.gateResults.filter(function (existing) { return !(existing.key === 'qa_business_assertion' && existing.status === 'pass'); })), false), [
|
|
1203
|
-
gate
|
|
1204
|
-
], false) });
|
|
1205
|
-
}
|
|
1206
|
-
var SUPPORT_PRODUCT_REPAIR_STEP_TYPES = new Set([
|
|
1207
|
-
'build_repair',
|
|
1208
|
-
'owner_scoped_repair',
|
|
1209
|
-
'product_repair',
|
|
1210
|
-
'code_repair'
|
|
1211
|
-
]);
|
|
1212
|
-
var SUPPORT_PRODUCT_REPAIR_ACTIONS = new Set([
|
|
1213
|
-
'run_owner_scoped_repair',
|
|
1214
|
-
'run_targeted_product_repair',
|
|
1215
|
-
'allow_product_repair'
|
|
1216
|
-
]);
|
|
1217
|
-
function supportSourceEditFiles(value) {
|
|
1218
|
-
return cleanStringList(value, 80, 500)
|
|
1219
|
-
.filter(function (filePath) {
|
|
1220
|
-
var normalized = filePath.replace(/\\/g, '/').toLowerCase();
|
|
1221
|
-
if (!normalized || /(^|\/)(qa-artifacts|runner-evidence|logs?|tmp|dist|node_modules)(\/|$)/.test(normalized)) {
|
|
1222
|
-
return false;
|
|
1223
|
-
}
|
|
1224
|
-
return /\.(?:ts|tsx|js|jsx|html|scss|css|json|mjs|cjs|vue|svelte|md)$/i.test(normalized);
|
|
1225
|
-
});
|
|
1226
|
-
}
|
|
1227
|
-
function supportRepairActivityFromRecord(value, source, index) {
|
|
1228
|
-
var record = plainObject(value);
|
|
1229
|
-
if (!Object.keys(record).length) {
|
|
1230
|
-
return undefined;
|
|
1231
|
-
}
|
|
1232
|
-
var stepType = cleanText(record.stepType || record.step_type || record.type, 120);
|
|
1233
|
-
var action = cleanText(record.action || record.primaryAction || record.primary_action || record.allowedDispatchAction || record.allowed_dispatch_action, 120);
|
|
1234
|
-
var lane = cleanText(record.lane || record.phase || record.category, 120).toLowerCase();
|
|
1235
|
-
var changedFiles = supportSourceEditFiles(record.changedFiles
|
|
1236
|
-
|| record.changed_files
|
|
1237
|
-
|| record.modifiedFiles
|
|
1238
|
-
|| record.modified_files
|
|
1239
|
-
|| record.editedFiles
|
|
1240
|
-
|| record.edited_files
|
|
1241
|
-
|| record.files);
|
|
1242
|
-
var explicitProductRepair = SUPPORT_PRODUCT_REPAIR_STEP_TYPES.has(stepType)
|
|
1243
|
-
|| SUPPORT_PRODUCT_REPAIR_ACTIONS.has(action)
|
|
1244
|
-
|| (lane === 'build' && changedFiles.length > 0);
|
|
1245
|
-
if (!explicitProductRepair) {
|
|
1246
|
-
return undefined;
|
|
1247
|
-
}
|
|
1248
|
-
var activityRef = cleanText(record.microtaskId
|
|
1249
|
-
|| record.microtask_id
|
|
1250
|
-
|| record.taskId
|
|
1251
|
-
|| record.task_id
|
|
1252
|
-
|| record.jobId
|
|
1253
|
-
|| record.job_id
|
|
1254
|
-
|| record._id
|
|
1255
|
-
|| record.id
|
|
1256
|
-
|| "".concat(source, ":").concat(index), 240);
|
|
1257
|
-
return { changedFiles: changedFiles, activityRef: activityRef };
|
|
1258
|
-
}
|
|
1259
|
-
function supportProductRepairEvidence(input, evidence) {
|
|
1260
|
-
var job = input.job || {};
|
|
1261
|
-
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);
|
|
1262
|
-
var activityRefs = [];
|
|
1263
|
-
var changedFiles = [];
|
|
1264
|
-
var activityCount = 0;
|
|
1265
|
-
records.forEach(function (record, index) {
|
|
1266
|
-
var activity = supportRepairActivityFromRecord(record, 'support_repair_activity', index);
|
|
1267
|
-
if (!activity) {
|
|
1268
|
-
return;
|
|
1269
|
-
}
|
|
1270
|
-
activityCount += 1;
|
|
1271
|
-
if (activity.activityRef) {
|
|
1272
|
-
activityRefs.push(activity.activityRef);
|
|
1273
|
-
}
|
|
1274
|
-
changedFiles.push.apply(changedFiles, __spreadArray([], __read(activity.changedFiles), false));
|
|
1275
|
-
});
|
|
1276
|
-
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));
|
|
1277
|
-
if (directChangedFiles.length) {
|
|
1278
|
-
activityCount += 1;
|
|
1279
|
-
activityRefs.push('changed_files');
|
|
1280
|
-
changedFiles.push.apply(changedFiles, __spreadArray([], __read(directChangedFiles), false));
|
|
1281
|
-
}
|
|
1282
|
-
var uniqueChangedFiles = Array.from(new Set(changedFiles.map(function (filePath) { return cleanText(filePath, 500); }).filter(Boolean))).slice(0, 80);
|
|
1283
|
-
return {
|
|
1284
|
-
attempted: activityCount > 0,
|
|
1285
|
-
changedFiles: uniqueChangedFiles,
|
|
1286
|
-
activityRefs: Array.from(new Set(activityRefs.map(function (ref) { return cleanText(ref, 240); }).filter(Boolean))).slice(0, 40),
|
|
1287
|
-
activityCount: activityCount
|
|
1288
|
-
};
|
|
1289
|
-
}
|
|
1290
|
-
function supportDiagnosisBeforeRepairGate(diagnosisGate, repairEvidence, now) {
|
|
1291
|
-
var _a, _b;
|
|
1292
|
-
if (!repairEvidence.attempted) {
|
|
1293
|
-
return undefined;
|
|
1294
|
-
}
|
|
1295
|
-
var validation = (0, support_runner_v5_1.validateResolveIOSupportDiagnosisGate)(diagnosisGate);
|
|
1296
|
-
var status = validation.valid ? 'pass' : 'blocked';
|
|
1297
|
-
return {
|
|
1298
|
-
key: 'support_diagnosis_before_repair',
|
|
1299
|
-
label: 'Support diagnosis before repair',
|
|
1300
|
-
status: status,
|
|
1301
|
-
reason: validation.valid
|
|
1302
|
-
? 'Support product repair has a valid root-cause diagnosis gate and owner-file scope.'
|
|
1303
|
-
: 'Support product repair is blocked until a valid SupportDiagnosisGate records reproduction/classification, accepted hypothesis, rejected alternatives, owner_files, and before/action/after proof.',
|
|
1304
|
-
evidenceRefs: repairEvidence.changedFiles,
|
|
1305
|
-
recordedAt: isoNow(now),
|
|
1306
|
-
metadata: {
|
|
1307
|
-
repairAttempted: true,
|
|
1308
|
-
activityCount: repairEvidence.activityCount,
|
|
1309
|
-
activityRefs: repairEvidence.activityRefs,
|
|
1310
|
-
changedFiles: repairEvidence.changedFiles,
|
|
1311
|
-
diagnosisValid: validation.valid,
|
|
1312
|
-
diagnosisStatus: validation.status,
|
|
1313
|
-
blockers: validation.blockers,
|
|
1314
|
-
ownerFiles: ((_a = validation.normalized) === null || _a === void 0 ? void 0 : _a.owner_files) || [],
|
|
1315
|
-
issueClass: (_b = validation.normalized) === null || _b === void 0 ? void 0 : _b.issue_class,
|
|
1316
|
-
productRepairAllowed: validation.valid,
|
|
1317
|
-
allowedDispatchAction: validation.valid ? 'run_owner_scoped_repair' : 'run_read_only_diagnosis',
|
|
1318
|
-
requiredEvidence: validation.valid
|
|
1319
|
-
? ['AIQaBusinessAssertion mapped to diagnosis proof_plan before acceptance']
|
|
1320
|
-
: ['support_diagnosis_gate JSON', 'reproduction or blocked-reproduction reason', 'accepted_hypothesis with evidence', 'owner_files', 'proof_plan before/action/after']
|
|
1321
|
-
}
|
|
1322
|
-
};
|
|
1323
|
-
}
|
|
1324
|
-
function evidenceObject() {
|
|
1325
|
-
var e_23, _a;
|
|
1326
|
-
var values = [];
|
|
1327
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1328
|
-
values[_i] = arguments[_i];
|
|
1329
|
-
}
|
|
1330
|
-
try {
|
|
1331
|
-
for (var values_1 = __values(values), values_1_1 = values_1.next(); !values_1_1.done; values_1_1 = values_1.next()) {
|
|
1332
|
-
var value = values_1_1.value;
|
|
1333
|
-
if (value && typeof value === 'object' && !Array.isArray(value)) {
|
|
1334
|
-
return value;
|
|
1335
|
-
}
|
|
1336
|
-
}
|
|
1337
|
-
}
|
|
1338
|
-
catch (e_23_1) { e_23 = { error: e_23_1 }; }
|
|
1339
|
-
finally {
|
|
1340
|
-
try {
|
|
1341
|
-
if (values_1_1 && !values_1_1.done && (_a = values_1.return)) _a.call(values_1);
|
|
1342
|
-
}
|
|
1343
|
-
finally { if (e_23) throw e_23.error; }
|
|
1344
|
-
}
|
|
1345
|
-
return {};
|
|
1346
|
-
}
|
|
1347
|
-
function mergeEvidenceRecords() {
|
|
1348
|
-
var e_24, _a, e_25, _b;
|
|
1349
|
-
var values = [];
|
|
1350
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1351
|
-
values[_i] = arguments[_i];
|
|
1352
|
-
}
|
|
1353
|
-
var merged = {};
|
|
1354
|
-
try {
|
|
1355
|
-
for (var values_2 = __values(values), values_2_1 = values_2.next(); !values_2_1.done; values_2_1 = values_2.next()) {
|
|
1356
|
-
var value = values_2_1.value;
|
|
1357
|
-
var source = plainObject(value);
|
|
1358
|
-
try {
|
|
1359
|
-
for (var _c = (e_25 = void 0, __values(Object.entries(source))), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
1360
|
-
var _e = __read(_d.value, 2), key = _e[0], entry = _e[1];
|
|
1361
|
-
if (entry === undefined || entry === null || entry === '') {
|
|
1362
|
-
continue;
|
|
1363
|
-
}
|
|
1364
|
-
if (Array.isArray(entry)) {
|
|
1365
|
-
merged[key] = __spreadArray(__spreadArray([], __read(asArray(merged[key])), false), __read(entry), false);
|
|
1366
|
-
continue;
|
|
1367
|
-
}
|
|
1368
|
-
if (plainObject(entry) === entry && plainObject(merged[key]) === merged[key]) {
|
|
1369
|
-
merged[key] = __assign(__assign({}, merged[key]), entry);
|
|
1370
|
-
continue;
|
|
1371
|
-
}
|
|
1372
|
-
merged[key] = entry;
|
|
1373
|
-
}
|
|
1374
|
-
}
|
|
1375
|
-
catch (e_25_1) { e_25 = { error: e_25_1 }; }
|
|
1376
|
-
finally {
|
|
1377
|
-
try {
|
|
1378
|
-
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
1379
|
-
}
|
|
1380
|
-
finally { if (e_25) throw e_25.error; }
|
|
1381
|
-
}
|
|
1382
|
-
}
|
|
1383
|
-
}
|
|
1384
|
-
catch (e_24_1) { e_24 = { error: e_24_1 }; }
|
|
1385
|
-
finally {
|
|
1386
|
-
try {
|
|
1387
|
-
if (values_2_1 && !values_2_1.done && (_a = values_2.return)) _a.call(values_2);
|
|
1388
|
-
}
|
|
1389
|
-
finally { if (e_24) throw e_24.error; }
|
|
1390
|
-
}
|
|
1391
|
-
return merged;
|
|
1392
|
-
}
|
|
1393
|
-
function buildSupportQaEvidence(input) {
|
|
1394
|
-
var job = input.job || {};
|
|
1395
|
-
var ticket = input.ticket || {};
|
|
1396
|
-
var qaCursor = plainObject(job.supportQaValidationCursor || job.support_qa_validation_cursor);
|
|
1397
|
-
var autonomousDecision = plainObject(job.supportV5AutonomousDecision || job.support_v5_autonomous_decision);
|
|
1398
|
-
var businessProofReadiness = plainObject(autonomousDecision.businessProofReadiness
|
|
1399
|
-
|| autonomousDecision.business_proof_readiness
|
|
1400
|
-
|| job.businessProofReadiness
|
|
1401
|
-
|| job.business_proof_readiness);
|
|
1402
|
-
var customerReplyPolicy = plainObject(autonomousDecision.customerReplyPolicy
|
|
1403
|
-
|| autonomousDecision.customer_reply_policy
|
|
1404
|
-
|| job.customerReplyPolicy
|
|
1405
|
-
|| job.customer_reply_policy);
|
|
1406
|
-
var humanReviewPacket = plainObject(autonomousDecision.humanReviewPacket
|
|
1407
|
-
|| autonomousDecision.human_review_packet
|
|
1408
|
-
|| customerReplyPolicy.humanReviewPacket
|
|
1409
|
-
|| customerReplyPolicy.human_review_packet
|
|
1410
|
-
|| job.humanReviewPacket
|
|
1411
|
-
|| job.human_review_packet);
|
|
1412
|
-
var evidence = mergeEvidenceRecords(qaCursor, job.qaEvidence, job.qa_evidence, ticket.qaEvidence, ticket.qa_evidence, input.qaEvidence);
|
|
1413
|
-
evidence.supportQaAssertions = __spreadArray(__spreadArray(__spreadArray([], __read(asArray(job.supportQaAssertions)), false), __read(asArray(job.support_qa_assertions)), false), __read(asArray(evidence.supportQaAssertions)), false);
|
|
1414
|
-
evidence.aiQaBusinessAssertions = __spreadArray(__spreadArray(__spreadArray([], __read(asArray(job.aiQaBusinessAssertions)), false), __read(asArray(job.ai_qa_business_assertions)), false), __read(asArray(evidence.aiQaBusinessAssertions)), false);
|
|
1415
|
-
evidence.runnerEvidenceArtifacts = __spreadArray(__spreadArray(__spreadArray([], __read(asArray(job.runnerEvidenceArtifacts)), false), __read(asArray(job.runner_evidence_artifacts)), false), __read(asArray(evidence.runnerEvidenceArtifacts)), false);
|
|
1416
|
-
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);
|
|
1417
|
-
if (Object.keys(businessProofReadiness).length) {
|
|
1418
|
-
evidence.businessProofReadiness = businessProofReadiness;
|
|
1419
|
-
}
|
|
1420
|
-
if (Object.keys(customerReplyPolicy).length) {
|
|
1421
|
-
evidence.customerReplyPolicy = __assign(__assign({}, customerReplyPolicy), (Object.keys(humanReviewPacket).length ? { humanReviewPacket: humanReviewPacket } : {}));
|
|
1422
|
-
}
|
|
1423
|
-
else if (Object.keys(humanReviewPacket).length) {
|
|
1424
|
-
evidence.customerReplyPolicy = { humanReviewPacket: humanReviewPacket };
|
|
1425
|
-
}
|
|
1426
|
-
return evidence;
|
|
1427
|
-
}
|
|
1428
|
-
function supportBusinessProofReadinessGate(readiness, now) {
|
|
1429
|
-
if (!readiness || !Object.keys(readiness).length) {
|
|
1430
|
-
return undefined;
|
|
1431
|
-
}
|
|
1432
|
-
var ready = readiness.ready === true;
|
|
1433
|
-
var readinessStatus = cleanText(readiness.status, 120).toLowerCase();
|
|
1434
|
-
var blockers = cleanStringList(readiness.blockers, 20, 500);
|
|
1435
|
-
var artifactPaths = cleanStringList(readiness.artifactPaths || readiness.artifact_paths, 40, 500);
|
|
1436
|
-
var proofFingerprint = cleanText(readiness.proofFingerprint || readiness.proof_fingerprint, 160);
|
|
1437
|
-
var artifactFingerprint = cleanText(readiness.artifactFingerprint || readiness.artifact_fingerprint, 160);
|
|
1438
|
-
var proofFreshness = cleanText(readiness.proofFreshness || readiness.proof_freshness, 120);
|
|
1439
|
-
var status = ready
|
|
1440
|
-
? 'pass'
|
|
1441
|
-
: /fail|failed/.test(readinessStatus)
|
|
1442
|
-
? 'fail'
|
|
1443
|
-
: /missing|route_only|blocked|weak|stale|incomplete/.test(readinessStatus)
|
|
1444
|
-
? 'blocked'
|
|
1445
|
-
: 'warn';
|
|
1446
|
-
return {
|
|
1447
|
-
key: 'support_business_proof_readiness',
|
|
1448
|
-
label: 'Support business proof readiness',
|
|
1449
|
-
status: status,
|
|
1450
|
-
reason: cleanText(readiness.reason || blockers.join('; ') || readinessStatus || 'Support business proof readiness recorded.', 1200),
|
|
1451
|
-
evidenceRefs: artifactPaths,
|
|
1452
|
-
recordedAt: isoNow(now || readiness.recordedAt || readiness.recorded_at),
|
|
1453
|
-
metadata: {
|
|
1454
|
-
ready: ready,
|
|
1455
|
-
status: readinessStatus,
|
|
1456
|
-
blockers: blockers,
|
|
1457
|
-
requiredEvidence: cleanStringList(readiness.requiredEvidence || readiness.required_evidence, 20, 500),
|
|
1458
|
-
proofFingerprint: proofFingerprint,
|
|
1459
|
-
artifactFingerprint: artifactFingerprint,
|
|
1460
|
-
proofFreshness: proofFreshness
|
|
1461
|
-
}
|
|
1462
|
-
};
|
|
1463
|
-
}
|
|
1464
|
-
function supportCustomerReplyPolicyGate(policy, now) {
|
|
1465
|
-
if (!policy || !Object.keys(policy).length) {
|
|
1466
|
-
return undefined;
|
|
1467
|
-
}
|
|
1468
|
-
var action = cleanText(policy.action, 120);
|
|
1469
|
-
var safety = cleanText(policy.safety, 120);
|
|
1470
|
-
var reason = cleanText(policy.reason, 1200);
|
|
1471
|
-
var canDraft = policy.canDraftCustomerReply === true || policy.can_draft_customer_reply === true;
|
|
1472
|
-
var canSend = policy.canSendCustomerReply === true || policy.can_send_customer_reply === true;
|
|
1473
|
-
var reviewPacket = plainObject(policy.humanReviewPacket || policy.human_review_packet);
|
|
1474
|
-
var reviewType = cleanText(reviewPacket.reviewType || reviewPacket.review_type, 160);
|
|
1475
|
-
var evidenceRefs = cleanStringList(reviewPacket.evidenceRefs || reviewPacket.evidence_refs, 40, 500);
|
|
1476
|
-
var blockers = cleanStringList(policy.blockers || reviewPacket.blockers, 20, 500);
|
|
1477
|
-
var gateStatus = canSend
|
|
1478
|
-
? 'blocked'
|
|
1479
|
-
: action === 'draft_resolution_reply' && canDraft
|
|
1480
|
-
? 'warn'
|
|
1481
|
-
: action === 'ask_clarification' && canDraft
|
|
1482
|
-
? 'warn'
|
|
1483
|
-
: 'blocked';
|
|
1484
|
-
return {
|
|
1485
|
-
key: 'support_customer_reply_policy',
|
|
1486
|
-
label: 'Support customer reply policy',
|
|
1487
|
-
status: gateStatus,
|
|
1488
|
-
reason: reason || action || 'Support customer reply policy recorded.',
|
|
1489
|
-
evidenceRefs: evidenceRefs,
|
|
1490
|
-
recordedAt: isoNow(now || policy.recordedAt || policy.recorded_at || reviewPacket.createdAt || reviewPacket.created_at),
|
|
1491
|
-
metadata: {
|
|
1492
|
-
action: action,
|
|
1493
|
-
safety: safety,
|
|
1494
|
-
canDraftCustomerReply: canDraft,
|
|
1495
|
-
canSendCustomerReply: canSend,
|
|
1496
|
-
confidenceLevel: cleanText(policy.confidenceLevel || policy.confidence_level, 120),
|
|
1497
|
-
reviewType: reviewType,
|
|
1498
|
-
primaryAction: cleanText(reviewPacket.primaryAction || reviewPacket.primary_action, 160),
|
|
1499
|
-
requiresHumanApproval: reviewPacket.requiresHumanApproval !== false && reviewPacket.requires_human_approval !== false,
|
|
1500
|
-
questionPresent: !!cleanText(policy.clarificationQuestion || policy.clarification_question || reviewPacket.question, 1000),
|
|
1501
|
-
blockers: blockers
|
|
1502
|
-
}
|
|
1503
|
-
};
|
|
1504
|
-
}
|
|
1505
|
-
function supportNextActionContractObject(ticket, job, evidence) {
|
|
1506
|
-
var ticketAutomation = plainObject(ticket.automation);
|
|
1507
|
-
var ticketManager = plainObject(ticketAutomation.manager || ticket.manager);
|
|
1508
|
-
var autonomousDecision = plainObject(job.supportV5AutonomousDecision
|
|
1509
|
-
|| job.support_v5_autonomous_decision
|
|
1510
|
-
|| evidence.supportV5AutonomousDecision
|
|
1511
|
-
|| evidence.support_v5_autonomous_decision
|
|
1512
|
-
|| ticket.supportV5AutonomousDecision
|
|
1513
|
-
|| ticket.support_v5_autonomous_decision);
|
|
1514
|
-
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);
|
|
1515
|
-
}
|
|
1516
|
-
function supportNextActionContractRequired(ticket, job, evidence) {
|
|
1517
|
-
var ticketAutomation = plainObject(ticket.automation);
|
|
1518
|
-
var ticketManager = plainObject(ticketAutomation.manager || ticket.manager);
|
|
1519
|
-
var workflowMarkers = [
|
|
1520
|
-
job.supportWorkflowMode,
|
|
1521
|
-
job.workflowMode,
|
|
1522
|
-
job.workflow_mode,
|
|
1523
|
-
job.supportWorkflowVersion,
|
|
1524
|
-
job.support_workflow_version,
|
|
1525
|
-
ticket.supportWorkflowMode,
|
|
1526
|
-
ticket.workflowMode,
|
|
1527
|
-
ticket.workflow_mode
|
|
1528
|
-
].map(function (value) { return cleanText(value, 80).toLowerCase(); });
|
|
1529
|
-
return workflowMarkers.some(function (value) { return value === 'support_v5' || value === 'v5'; })
|
|
1530
|
-
|| !!job.supportV5SupervisorState
|
|
1531
|
-
|| !!job.supportV5MicrotaskLedger
|
|
1532
|
-
|| !!job.supportV5StepHistory
|
|
1533
|
-
|| !!job.supportV5DiagnosisGate
|
|
1534
|
-
|| !!job.supportV5DiagnosisEvidencePack
|
|
1535
|
-
|| !!job.support_v5_supervisor_state
|
|
1536
|
-
|| !!job.support_v5_microtask_ledger
|
|
1537
|
-
|| !!job.support_v5_step_history
|
|
1538
|
-
|| !!job.support_v5_diagnosis_gate
|
|
1539
|
-
|| !!job.support_v5_diagnosis_evidence_pack
|
|
1540
|
-
|| !!job.supportRootCauseEntryContract
|
|
1541
|
-
|| !!job.support_root_cause_entry_contract
|
|
1542
|
-
|| !!evidence.supportV5AutonomousDecision
|
|
1543
|
-
|| !!evidence.support_v5_autonomous_decision
|
|
1544
|
-
|| !!evidence.rootCauseReadiness
|
|
1545
|
-
|| !!evidence.root_cause_readiness
|
|
1546
|
-
|| !!ticketManager.root_cause_entry_contract
|
|
1547
|
-
|| !!ticketManager.rootCauseEntryContract
|
|
1548
|
-
|| !!ticketManager.last_watchdog_decision;
|
|
1549
|
-
}
|
|
1550
|
-
function supportNextActionContractMetadata(contract) {
|
|
1551
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
1552
|
-
var decisionBasis = plainObject(contract.decisionBasis || contract.decision_basis);
|
|
1553
|
-
var costRisk = plainObject(contract.costRisk || contract.cost_risk);
|
|
1554
|
-
var source = {
|
|
1555
|
-
contractId: cleanText(contract.contractId || contract.contract_id, 200),
|
|
1556
|
-
action: cleanText(contract.action, 160),
|
|
1557
|
-
label: cleanText(contract.label, 300),
|
|
1558
|
-
primaryCommand: cleanText(contract.primaryCommand || contract.primary_command, 240),
|
|
1559
|
-
lane: cleanText(contract.lane, 120),
|
|
1560
|
-
stepType: cleanText(contract.stepType || contract.step_type, 120),
|
|
1561
|
-
safeToAutoRun: booleanFlag((_a = contract.safeToAutoRun) !== null && _a !== void 0 ? _a : contract.safe_to_auto_run),
|
|
1562
|
-
requiresHumanApproval: booleanFlag((_b = contract.requiresHumanApproval) !== null && _b !== void 0 ? _b : contract.requires_human_approval),
|
|
1563
|
-
canRunWithoutCodexMonitor: booleanFlag((_c = contract.canRunWithoutCodexMonitor) !== null && _c !== void 0 ? _c : contract.can_run_without_codex_monitor),
|
|
1564
|
-
codexFallbackRequired: booleanFlag((_d = contract.codexFallbackRequired) !== null && _d !== void 0 ? _d : contract.codex_fallback_required),
|
|
1565
|
-
codexFallbackReason: cleanText(contract.codexFallbackReason || contract.codex_fallback_reason, 1000),
|
|
1566
|
-
rootCauseFirstSatisfied: booleanFlag((_e = contract.rootCauseFirstSatisfied) !== null && _e !== void 0 ? _e : contract.root_cause_first_satisfied),
|
|
1567
|
-
preconditions: cleanStringList(contract.preconditions, 40, 500),
|
|
1568
|
-
expectedStateTransition: cleanText(contract.expectedStateTransition || contract.expected_state_transition, 1000),
|
|
1569
|
-
successEvidence: cleanStringList(contract.successEvidence || contract.success_evidence, 40, 500),
|
|
1570
|
-
stopConditions: cleanStringList(contract.stopConditions || contract.stop_conditions, 40, 500),
|
|
1571
|
-
forbiddenActions: cleanStringList(contract.forbiddenActions || contract.forbidden_actions, 40, 500),
|
|
1572
|
-
ownerFiles: cleanStringList(contract.ownerFiles || contract.owner_files || decisionBasis.ownerFiles || decisionBasis.owner_files, 40, 500),
|
|
1573
|
-
blockers: cleanStringList(contract.blockers, 40, 500),
|
|
1574
|
-
nextCommands: cleanStringList(contract.nextCommands || contract.next_commands, 40, 500),
|
|
1575
|
-
costRisk: {
|
|
1576
|
-
level: cleanText(costRisk.level || contract.costRiskLevel || contract.cost_risk_level, 80),
|
|
1577
|
-
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),
|
|
1578
|
-
reason: cleanText(costRisk.reason, 800)
|
|
1579
|
-
},
|
|
1580
|
-
diagnosisValid: booleanFlag((_j = decisionBasis.diagnosisValid) !== null && _j !== void 0 ? _j : decisionBasis.diagnosis_valid),
|
|
1581
|
-
ownerFilesReady: booleanFlag((_k = decisionBasis.ownerFilesReady) !== null && _k !== void 0 ? _k : decisionBasis.owner_files_ready),
|
|
1582
|
-
proofPlanReady: booleanFlag((_l = decisionBasis.proofPlanReady) !== null && _l !== void 0 ? _l : decisionBasis.proof_plan_ready),
|
|
1583
|
-
businessProofReady: booleanFlag((_m = decisionBasis.businessProofReady) !== null && _m !== void 0 ? _m : decisionBasis.business_proof_ready),
|
|
1584
|
-
evidenceFreshnessStatus: cleanText(decisionBasis.evidenceFreshnessStatus || decisionBasis.evidence_freshness_status, 120),
|
|
1585
|
-
evidenceStrength: cleanText(decisionBasis.evidenceStrength || decisionBasis.evidence_strength, 120),
|
|
1586
|
-
failureClass: cleanText(decisionBasis.failureClass || decisionBasis.failure_class, 120),
|
|
1587
|
-
blockerFingerprint: cleanText(decisionBasis.blockerFingerprint || decisionBasis.blocker_fingerprint, 200),
|
|
1588
|
-
evidenceHash: cleanText(decisionBasis.evidenceHash || decisionBasis.evidence_hash, 200),
|
|
1589
|
-
sameFailureCount: numberValue((_o = decisionBasis.sameFailureCount) !== null && _o !== void 0 ? _o : decisionBasis.same_failure_count),
|
|
1590
|
-
hotfixCommitRequired: booleanFlag((_r = (_q = (_p = decisionBasis.hotfixCommitRequired) !== null && _p !== void 0 ? _p : decisionBasis.hotfix_commit_required) !== null && _q !== void 0 ? _q : contract.hotfixCommitRequired) !== null && _r !== void 0 ? _r : contract.hotfix_commit_required),
|
|
1591
|
-
liveHotfixBlockedUntilCommit: booleanFlag((_u = (_t = (_s = decisionBasis.liveHotfixBlockedUntilCommit) !== null && _s !== void 0 ? _s : decisionBasis.live_hotfix_blocked_until_commit) !== null && _t !== void 0 ? _t : contract.liveHotfixBlockedUntilCommit) !== null && _u !== void 0 ? _u : contract.live_hotfix_blocked_until_commit)
|
|
1592
|
-
};
|
|
1593
|
-
return source;
|
|
1594
|
-
}
|
|
1595
|
-
function supportNextActionContractGate(contract, now, required) {
|
|
1596
|
-
if (required === void 0) { required = false; }
|
|
1597
|
-
if (!contract || !Object.keys(contract).length) {
|
|
1598
|
-
if (!required) {
|
|
1599
|
-
return undefined;
|
|
1600
|
-
}
|
|
1601
|
-
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.';
|
|
1602
|
-
return {
|
|
1603
|
-
key: 'support_next_action_contract',
|
|
1604
|
-
label: 'Support next-action contract',
|
|
1605
|
-
status: 'blocked',
|
|
1606
|
-
reason: blocker,
|
|
1607
|
-
evidenceRefs: [],
|
|
1608
|
-
recordedAt: isoNow(now),
|
|
1609
|
-
metadata: {
|
|
1610
|
-
required: true,
|
|
1611
|
-
missingContract: true,
|
|
1612
|
-
safeToAutoRun: false,
|
|
1613
|
-
canRunWithoutCodexMonitor: false,
|
|
1614
|
-
codexFallbackRequired: true,
|
|
1615
|
-
codexFallbackReason: 'missing_support_next_action_contract',
|
|
1616
|
-
blockers: [blocker],
|
|
1617
|
-
missingSafetyFlags: ['safeToAutoRun', 'canRunWithoutCodexMonitor', 'codexFallbackRequired']
|
|
1618
|
-
}
|
|
1619
|
-
};
|
|
1620
|
-
}
|
|
1621
|
-
var metadata = supportNextActionContractMetadata(contract);
|
|
1622
|
-
var blockers = cleanStringList(metadata.blockers, 40, 500);
|
|
1623
|
-
if (metadata.safeToAutoRun === false) {
|
|
1624
|
-
blockers.push('Next action contract marks the action unsafe for autonomous run.');
|
|
1625
|
-
}
|
|
1626
|
-
if (metadata.canRunWithoutCodexMonitor === false) {
|
|
1627
|
-
blockers.push('Next action requires Codex fallback/monitoring instead of manager-only execution.');
|
|
1628
|
-
}
|
|
1629
|
-
if (metadata.codexFallbackRequired === true) {
|
|
1630
|
-
blockers.push(metadata.codexFallbackReason || 'Next action contract requires Codex fallback.');
|
|
1631
|
-
}
|
|
1632
|
-
if (metadata.requiresHumanApproval === true) {
|
|
1633
|
-
blockers.push('Next action contract requires human approval.');
|
|
1634
|
-
}
|
|
1635
|
-
if (metadata.liveHotfixBlockedUntilCommit === true) {
|
|
1636
|
-
blockers.push('Live hotfix is blocked until the manager records and pushes the GitHub commit proof.');
|
|
1637
|
-
}
|
|
1638
|
-
var missingSafetyFlags = [
|
|
1639
|
-
metadata.safeToAutoRun === undefined ? 'safeToAutoRun' : '',
|
|
1640
|
-
metadata.canRunWithoutCodexMonitor === undefined ? 'canRunWithoutCodexMonitor' : '',
|
|
1641
|
-
metadata.codexFallbackRequired === undefined ? 'codexFallbackRequired' : ''
|
|
1642
|
-
].filter(Boolean);
|
|
1643
|
-
var status = blockers.length
|
|
1644
|
-
? 'blocked'
|
|
1645
|
-
: missingSafetyFlags.length
|
|
1646
|
-
? 'warn'
|
|
1647
|
-
: 'pass';
|
|
1648
|
-
var actionLabel = metadata.label || metadata.action || metadata.primaryCommand || 'support next action';
|
|
1649
|
-
return {
|
|
1650
|
-
key: 'support_next_action_contract',
|
|
1651
|
-
label: 'Support next-action contract',
|
|
1652
|
-
status: status,
|
|
1653
|
-
reason: blockers.length
|
|
1654
|
-
? blockers.join(' ')
|
|
1655
|
-
: missingSafetyFlags.length
|
|
1656
|
-
? "Support next-action contract is present for ".concat(actionLabel, ", but missing explicit safety flags: ").concat(missingSafetyFlags.join(', '), ".")
|
|
1657
|
-
: "Support next-action contract allows ".concat(actionLabel, " without Codex monitoring."),
|
|
1658
|
-
evidenceRefs: cleanStringList(__spreadArray(__spreadArray(__spreadArray([], __read(metadata.successEvidence), false), __read(metadata.preconditions), false), __read(metadata.stopConditions), false), 40, 500),
|
|
1659
|
-
recordedAt: isoNow(now || contract.createdAt || contract.created_at || contract.recordedAt || contract.recorded_at),
|
|
1660
|
-
metadata: __assign(__assign({}, metadata), { blockers: blockers, missingSafetyFlags: missingSafetyFlags })
|
|
1661
|
-
};
|
|
1662
|
-
}
|
|
1663
|
-
function supportDiagnosisEvidencePackObject(ticket, job, evidence) {
|
|
1664
|
-
var ticketAutomation = plainObject(ticket.automation);
|
|
1665
|
-
var ticketManager = plainObject(ticketAutomation.manager || ticket.manager);
|
|
1666
|
-
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);
|
|
1667
|
-
}
|
|
1668
|
-
function supportSimilarFixHintsObject(ticket, job, evidence) {
|
|
1669
|
-
var ticketAutomation = plainObject(ticket.automation);
|
|
1670
|
-
var ticketManager = plainObject(ticketAutomation.manager || ticket.manager);
|
|
1671
|
-
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);
|
|
1672
|
-
}
|
|
1673
|
-
function supportDiagnosisEvidencePackGate(pack, now) {
|
|
1674
|
-
if (!pack || !Object.keys(pack).length) {
|
|
1675
|
-
return undefined;
|
|
1676
|
-
}
|
|
1677
|
-
var statusText = cleanText(pack.status, 120);
|
|
1678
|
-
var diagnosisValid = pack.diagnosisValid === true || pack.diagnosis_valid === true;
|
|
1679
|
-
var validationBlockers = cleanStringList(pack.validationBlockers || pack.validation_blockers, 40, 500);
|
|
1680
|
-
var similarSelection = plainObject(pack.similarCaseSelection || pack.similar_case_selection);
|
|
1681
|
-
var rankedHints = asArray(similarSelection.ranked);
|
|
1682
|
-
var gateStatus = diagnosisValid || statusText === 'diagnosis_ready'
|
|
1683
|
-
? 'pass'
|
|
1684
|
-
: statusText === 'blocked'
|
|
1685
|
-
? 'blocked'
|
|
1686
|
-
: 'warn';
|
|
1687
|
-
return {
|
|
1688
|
-
key: 'support_diagnosis_evidence_pack',
|
|
1689
|
-
label: 'Support diagnosis evidence pack',
|
|
1690
|
-
status: gateStatus,
|
|
1691
|
-
reason: gateStatus === 'pass'
|
|
1692
|
-
? 'Support diagnosis evidence pack has a valid root-cause diagnosis and advisory similar-fix context.'
|
|
1693
|
-
: validationBlockers.join('; ') || 'Support diagnosis evidence pack requires read-only root-cause evidence before repair.',
|
|
1694
|
-
evidenceRefs: cleanStringList(pack.requiredEvidence || pack.required_evidence, 30, 500),
|
|
1695
|
-
recordedAt: isoNow(now || pack.generatedAt || pack.generated_at),
|
|
1696
|
-
metadata: {
|
|
1697
|
-
packId: cleanText(pack.packId || pack.pack_id, 180),
|
|
1698
|
-
status: statusText,
|
|
1699
|
-
readOnly: pack.readOnly !== false && pack.read_only !== false,
|
|
1700
|
-
sourceEditsAllowed: pack.sourceEditsAllowed === true || pack.source_edits_allowed === true,
|
|
1701
|
-
rootCauseFirstRequired: pack.rootCauseFirstRequired !== false && pack.root_cause_first_required !== false,
|
|
1702
|
-
requiredOutputKey: cleanText(pack.requiredOutputKey || pack.required_output_key, 120),
|
|
1703
|
-
requiredFields: cleanStringList(pack.requiredFields || pack.required_fields, 20, 160),
|
|
1704
|
-
forbiddenActions: cleanStringList(pack.forbiddenActions || pack.forbidden_actions, 20, 500),
|
|
1705
|
-
diagnosisValid: diagnosisValid,
|
|
1706
|
-
diagnosisStatus: cleanText(pack.diagnosisStatus || pack.diagnosis_status, 120),
|
|
1707
|
-
validationBlockers: validationBlockers,
|
|
1708
|
-
issueClassHint: cleanText(pack.issueClassHint || pack.issue_class_hint, 120),
|
|
1709
|
-
ownerFileHints: cleanStringList(pack.ownerFileHints || pack.owner_file_hints, 20, 500),
|
|
1710
|
-
similarHintCount: rankedHints.length,
|
|
1711
|
-
similarHintsAdvisoryOnly: true,
|
|
1712
|
-
issueClassProbeCount: asArray(pack.issueClassProbeCatalog || pack.issue_class_probe_catalog).length
|
|
1713
|
-
}
|
|
1714
|
-
};
|
|
1715
|
-
}
|
|
1716
|
-
function firstNonEmptyText(values, max) {
|
|
1717
|
-
var e_26, _a;
|
|
1718
|
-
if (max === void 0) { max = 1000; }
|
|
1719
|
-
try {
|
|
1720
|
-
for (var values_3 = __values(values), values_3_1 = values_3.next(); !values_3_1.done; values_3_1 = values_3.next()) {
|
|
1721
|
-
var value = values_3_1.value;
|
|
1722
|
-
var normalized = idText(value, max);
|
|
1723
|
-
if (normalized) {
|
|
1724
|
-
return normalized;
|
|
1725
|
-
}
|
|
1726
|
-
}
|
|
1727
|
-
}
|
|
1728
|
-
catch (e_26_1) { e_26 = { error: e_26_1 }; }
|
|
1729
|
-
finally {
|
|
1730
|
-
try {
|
|
1731
|
-
if (values_3_1 && !values_3_1.done && (_a = values_3.return)) _a.call(values_3);
|
|
1732
|
-
}
|
|
1733
|
-
finally { if (e_26) throw e_26.error; }
|
|
1734
|
-
}
|
|
1735
|
-
return undefined;
|
|
1736
|
-
}
|
|
1737
|
-
function booleanFlag(value) {
|
|
1738
|
-
if (value === true || value === false) {
|
|
1739
|
-
return value;
|
|
1740
|
-
}
|
|
1741
|
-
if (typeof value === 'string') {
|
|
1742
|
-
var normalized = value.trim().toLowerCase();
|
|
1743
|
-
if (/^(true|yes|1|passed|pass|ready|safe)$/.test(normalized)) {
|
|
1744
|
-
return true;
|
|
1745
|
-
}
|
|
1746
|
-
if (/^(false|no|0|failed|fail|blocked|unsafe)$/.test(normalized)) {
|
|
1747
|
-
return false;
|
|
1748
|
-
}
|
|
1749
|
-
}
|
|
1750
|
-
return undefined;
|
|
1751
|
-
}
|
|
1752
|
-
function numberValue(value) {
|
|
1753
|
-
var parsed = Number(value);
|
|
1754
|
-
return Number.isFinite(parsed) ? parsed : undefined;
|
|
1755
|
-
}
|
|
1756
|
-
function buildAICoderQaEvidence(input) {
|
|
1757
|
-
var _a, _b, _c;
|
|
1758
|
-
var app = input.app || {};
|
|
1759
|
-
var job = input.job || {};
|
|
1760
|
-
var workflowMemory = plainObject(job.aiCoderV6WorkflowMemory
|
|
1761
|
-
|| job.ai_coder_v6_workflow_memory
|
|
1762
|
-
|| app.aiCoderV6WorkflowMemory
|
|
1763
|
-
|| app.ai_coder_v6_workflow_memory);
|
|
1764
|
-
var evidence = mergeEvidenceRecords(job.qaEvidence, job.qa_evidence, app.qaEvidence, app.qa_evidence, input.qaEvidence);
|
|
1765
|
-
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);
|
|
1766
|
-
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);
|
|
1767
|
-
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);
|
|
1768
|
-
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);
|
|
1769
|
-
evidence.journeyContract = evidence.journeyContract
|
|
1770
|
-
|| evidence.journey_contract
|
|
1771
|
-
|| job.journeyContract
|
|
1772
|
-
|| job.journey_contract
|
|
1773
|
-
|| app.journeyContract
|
|
1774
|
-
|| app.journey_contract
|
|
1775
|
-
|| workflowMemory.journeyContract
|
|
1776
|
-
|| workflowMemory.journey_contract;
|
|
1777
|
-
evidence.journeyContractMarkdown = evidence.journeyContractMarkdown
|
|
1778
|
-
|| evidence.journey_contract_markdown
|
|
1779
|
-
|| job.journeyContractMarkdown
|
|
1780
|
-
|| job.journey_contract_markdown
|
|
1781
|
-
|| app.journeyContractMarkdown
|
|
1782
|
-
|| app.journey_contract_markdown;
|
|
1783
|
-
evidence.deployStatus = firstNonEmptyText([
|
|
1784
|
-
evidence.deployStatus,
|
|
1785
|
-
evidence.deploy_status,
|
|
1786
|
-
job.deployStatus,
|
|
1787
|
-
job.deploy_status,
|
|
1788
|
-
job.testDeployStatus,
|
|
1789
|
-
job.test_deploy_status,
|
|
1790
|
-
app.deployStatus,
|
|
1791
|
-
app.deploy_status
|
|
1792
|
-
], 160);
|
|
1793
|
-
evidence.publishStatus = firstNonEmptyText([
|
|
1794
|
-
evidence.publishStatus,
|
|
1795
|
-
evidence.publish_status,
|
|
1796
|
-
evidence.pullRequestStatus,
|
|
1797
|
-
evidence.pull_request_status,
|
|
1798
|
-
job.publishStatus,
|
|
1799
|
-
job.publish_status,
|
|
1800
|
-
job.pullRequestStatus,
|
|
1801
|
-
job.pull_request_status,
|
|
1802
|
-
app.publishStatus,
|
|
1803
|
-
app.publish_status
|
|
1804
|
-
], 160);
|
|
1805
|
-
evidence.sampleDataStatus = firstNonEmptyText([
|
|
1806
|
-
evidence.sampleDataStatus,
|
|
1807
|
-
evidence.sample_data_status,
|
|
1808
|
-
job.sampleDataStatus,
|
|
1809
|
-
job.sample_data_status,
|
|
1810
|
-
app.sampleDataStatus,
|
|
1811
|
-
app.sample_data_status
|
|
1812
|
-
], 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);
|
|
1813
|
-
return evidence;
|
|
1814
|
-
}
|
|
1815
|
-
function normalizeAICoderWorkflowProofReadiness(value, now) {
|
|
1816
|
-
if (!value || !Object.keys(value).length) {
|
|
1817
|
-
return undefined;
|
|
1818
|
-
}
|
|
1819
|
-
var ready = value.ready === true;
|
|
1820
|
-
var status = cleanText(value.status, 120) || (ready ? 'ready' : 'blocked');
|
|
1821
|
-
return {
|
|
1822
|
-
ready: ready,
|
|
1823
|
-
status: status,
|
|
1824
|
-
reason: cleanText(value.reason || value.summary || status, 1200),
|
|
1825
|
-
blockers: cleanStringList(value.blockers, 40, 500),
|
|
1826
|
-
journeyContractValid: value.journeyContractValid === true || value.journey_contract_valid === true,
|
|
1827
|
-
primaryWorkflowId: cleanText(value.primaryWorkflowId || value.primary_workflow_id, 200),
|
|
1828
|
-
passedWorkflowRows: cleanStringList(value.passedWorkflowRows || value.passed_workflow_rows, 80, 300),
|
|
1829
|
-
missingWorkflowRows: cleanStringList(value.missingWorkflowRows || value.missing_workflow_rows, 80, 300),
|
|
1830
|
-
failedWorkflowRows: cleanStringList(value.failedWorkflowRows || value.failed_workflow_rows, 80, 300),
|
|
1831
|
-
passedBusinessAssertions: cleanStringList(value.passedBusinessAssertions || value.passed_business_assertions, 80, 500),
|
|
1832
|
-
routeOnly: value.routeOnly === true || value.route_only === true,
|
|
1833
|
-
scorecardOnly: value.scorecardOnly === true || value.scorecard_only === true,
|
|
1834
|
-
sampleDataReady: value.sampleDataReady === true || value.sample_data_ready === true,
|
|
1835
|
-
releaseBlockers: cleanStringList(value.releaseBlockers || value.release_blockers, 40, 500),
|
|
1836
|
-
artifactPaths: cleanStringList(value.artifactPaths || value.artifact_paths, 80, 500),
|
|
1837
|
-
workflowProofFingerprint: cleanText(value.workflowProofFingerprint || value.workflow_proof_fingerprint, 200),
|
|
1838
|
-
artifactFingerprint: cleanText(value.artifactFingerprint || value.artifact_fingerprint, 200),
|
|
1839
|
-
proofFreshness: cleanText(value.proofFreshness || value.proof_freshness, 80),
|
|
1840
|
-
nextAction: cleanText(value.nextAction || value.next_action, 1000),
|
|
1841
|
-
evaluatedAt: isoNow(now || value.evaluatedAt || value.evaluated_at || value.recordedAt || value.recorded_at)
|
|
1842
|
-
};
|
|
1843
|
-
}
|
|
1844
|
-
function aicoderWorkflowProofReadinessGate(readiness, now) {
|
|
1845
|
-
var status = readiness.ready
|
|
1846
|
-
? 'pass'
|
|
1847
|
-
: readiness.status === 'release_blocked' || readiness.status === 'journey_invalid' || readiness.status === 'sample_data_missing'
|
|
1848
|
-
? 'fail'
|
|
1849
|
-
: 'blocked';
|
|
1850
|
-
return {
|
|
1851
|
-
key: 'aicoder_workflow_proof_readiness',
|
|
1852
|
-
label: 'AICoder workflow proof readiness',
|
|
1853
|
-
status: status,
|
|
1854
|
-
reason: readiness.reason || readiness.blockers.join('; ') || readiness.status,
|
|
1855
|
-
evidenceRefs: readiness.artifactPaths,
|
|
1856
|
-
recordedAt: isoNow(now || readiness.evaluatedAt),
|
|
1857
|
-
metadata: {
|
|
1858
|
-
ready: readiness.ready,
|
|
1859
|
-
status: readiness.status,
|
|
1860
|
-
primaryWorkflowId: readiness.primaryWorkflowId,
|
|
1861
|
-
journeyContractValid: readiness.journeyContractValid,
|
|
1862
|
-
blockers: readiness.blockers,
|
|
1863
|
-
passedWorkflowRows: readiness.passedWorkflowRows,
|
|
1864
|
-
missingWorkflowRows: readiness.missingWorkflowRows,
|
|
1865
|
-
failedWorkflowRows: readiness.failedWorkflowRows,
|
|
1866
|
-
passedBusinessAssertions: readiness.passedBusinessAssertions,
|
|
1867
|
-
routeOnly: readiness.routeOnly,
|
|
1868
|
-
scorecardOnly: readiness.scorecardOnly,
|
|
1869
|
-
sampleDataReady: readiness.sampleDataReady,
|
|
1870
|
-
releaseBlockers: readiness.releaseBlockers,
|
|
1871
|
-
workflowProofFingerprint: readiness.workflowProofFingerprint,
|
|
1872
|
-
artifactFingerprint: readiness.artifactFingerprint,
|
|
1873
|
-
proofFreshness: readiness.proofFreshness,
|
|
1874
|
-
nextAction: readiness.nextAction
|
|
1875
|
-
}
|
|
1876
|
-
};
|
|
1877
|
-
}
|
|
1878
|
-
function aicoderWorkflowProofCheckpointObject(app, job, evidence) {
|
|
1879
|
-
var workflowMemory = plainObject(job.aiCoderV6WorkflowMemory
|
|
1880
|
-
|| job.ai_coder_v6_workflow_memory
|
|
1881
|
-
|| app.aiCoderV6WorkflowMemory
|
|
1882
|
-
|| app.ai_coder_v6_workflow_memory
|
|
1883
|
-
|| evidence.aiCoderV6WorkflowMemory
|
|
1884
|
-
|| evidence.ai_coder_v6_workflow_memory);
|
|
1885
|
-
var continuationDecision = plainObject(job.aicoderV6ContinuationDecision
|
|
1886
|
-
|| job.aiCoderV6ContinuationDecision
|
|
1887
|
-
|| job.aicoder_v6_continuation_decision
|
|
1888
|
-
|| job.ai_coder_v6_continuation_decision
|
|
1889
|
-
|| app.aicoderV6ContinuationDecision
|
|
1890
|
-
|| app.aiCoderV6ContinuationDecision
|
|
1891
|
-
|| app.aicoder_v6_continuation_decision
|
|
1892
|
-
|| evidence.aicoderV6ContinuationDecision
|
|
1893
|
-
|| evidence.aiCoderV6ContinuationDecision
|
|
1894
|
-
|| evidence.aicoder_v6_continuation_decision);
|
|
1895
|
-
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);
|
|
1896
|
-
}
|
|
1897
|
-
function aicoderWorkflowProofCheckpointGate(checkpoint, now) {
|
|
1898
|
-
var _a, _b, _c, _d, _e;
|
|
1899
|
-
if (!checkpoint || !Object.keys(checkpoint).length) {
|
|
1900
|
-
return undefined;
|
|
1901
|
-
}
|
|
1902
|
-
var blocksProductRepairUntilJourneyContract = booleanFlag((_a = checkpoint.blocksProductRepairUntilJourneyContract) !== null && _a !== void 0 ? _a : checkpoint.blocks_product_repair_until_journey_contract) === true;
|
|
1903
|
-
var blocksPublishUntilWorkflowProof = booleanFlag((_b = checkpoint.blocksPublishUntilWorkflowProof) !== null && _b !== void 0 ? _b : checkpoint.blocks_publish_until_workflow_proof) === true;
|
|
1904
|
-
var blocksPublishUntilReleaseGate = booleanFlag((_c = checkpoint.blocksPublishUntilReleaseGate) !== null && _c !== void 0 ? _c : checkpoint.blocks_publish_until_release_gate) === true;
|
|
1905
|
-
var blocksWowUiUntilWorkflowProof = booleanFlag((_d = checkpoint.blocksWowUiUntilWorkflowProof) !== null && _d !== void 0 ? _d : checkpoint.blocks_wow_ui_until_workflow_proof) === true;
|
|
1906
|
-
var statusText = cleanText(checkpoint.status, 120);
|
|
1907
|
-
var required = booleanFlag(checkpoint.required) !== false;
|
|
1908
|
-
var blockers = cleanStringList(checkpoint.blockers, 40, 500);
|
|
1909
|
-
if (blocksProductRepairUntilJourneyContract) {
|
|
1910
|
-
blockers.push('Product repair is blocked until the journey contract is valid.');
|
|
1911
|
-
}
|
|
1912
|
-
if (blocksPublishUntilWorkflowProof) {
|
|
1913
|
-
blockers.push('Publish is blocked until workflow business proof passes.');
|
|
1914
|
-
}
|
|
1915
|
-
if (blocksPublishUntilReleaseGate) {
|
|
1916
|
-
blockers.push('Publish is blocked until release gate evidence passes.');
|
|
1917
|
-
}
|
|
1918
|
-
if (blocksWowUiUntilWorkflowProof) {
|
|
1919
|
-
blockers.push('Wow UI polish is blocked until workflow proof exists.');
|
|
1920
|
-
}
|
|
1921
|
-
var gateStatus = !required || statusText === 'ready_to_continue'
|
|
1922
|
-
? 'pass'
|
|
1923
|
-
: blockers.length
|
|
1924
|
-
? 'blocked'
|
|
1925
|
-
: 'warn';
|
|
1926
|
-
return {
|
|
1927
|
-
key: 'aicoder_workflow_proof_checkpoint',
|
|
1928
|
-
label: 'AICoder workflow proof checkpoint',
|
|
1929
|
-
status: gateStatus,
|
|
1930
|
-
reason: gateStatus === 'pass'
|
|
1931
|
-
? 'AICoder workflow checkpoint allows the next action.'
|
|
1932
|
-
: (blockers.join(' ') || cleanText(checkpoint.nextAction || checkpoint.next_action || statusText, 1200) || 'AICoder workflow checkpoint requires more proof before continuing.'),
|
|
1933
|
-
evidenceRefs: cleanStringList(__spreadArray(__spreadArray([], __read(asArray(checkpoint.requiredEvidence || checkpoint.required_evidence)), false), __read(asArray(checkpoint.requiredResetEvidence || checkpoint.required_reset_evidence)), false), 40, 500),
|
|
1934
|
-
recordedAt: isoNow(now || checkpoint.recordedAt || checkpoint.recorded_at || checkpoint.createdAt || checkpoint.created_at),
|
|
1935
|
-
metadata: {
|
|
1936
|
-
required: required,
|
|
1937
|
-
status: statusText,
|
|
1938
|
-
readinessStatus: cleanText(checkpoint.readinessStatus || checkpoint.readiness_status, 120),
|
|
1939
|
-
nextGate: cleanText(checkpoint.nextGate || checkpoint.next_gate, 120),
|
|
1940
|
-
nextAction: cleanText(checkpoint.nextAction || checkpoint.next_action, 1000),
|
|
1941
|
-
startingFailureClass: cleanText(checkpoint.startingFailureClass || checkpoint.starting_failure_class, 120),
|
|
1942
|
-
startingBlockerFingerprint: cleanText(checkpoint.startingBlockerFingerprint || checkpoint.starting_blocker_fingerprint, 200),
|
|
1943
|
-
startingEvidenceHash: cleanText(checkpoint.startingEvidenceHash || checkpoint.starting_evidence_hash, 200),
|
|
1944
|
-
workflowProofFingerprint: cleanText(checkpoint.workflowProofFingerprint || checkpoint.workflow_proof_fingerprint, 200),
|
|
1945
|
-
artifactFingerprint: cleanText(checkpoint.artifactFingerprint || checkpoint.artifact_fingerprint, 200),
|
|
1946
|
-
requiredEvidence: cleanStringList(checkpoint.requiredEvidence || checkpoint.required_evidence, 40, 500),
|
|
1947
|
-
requiredResetEvidence: cleanStringList(checkpoint.requiredResetEvidence || checkpoint.required_reset_evidence, 40, 500),
|
|
1948
|
-
successRequiresWorkflowBusinessProof: booleanFlag((_e = checkpoint.successRequiresWorkflowBusinessProof) !== null && _e !== void 0 ? _e : checkpoint.success_requires_workflow_business_proof) === true,
|
|
1949
|
-
blocksProductRepairUntilJourneyContract: blocksProductRepairUntilJourneyContract,
|
|
1950
|
-
blocksPublishUntilWorkflowProof: blocksPublishUntilWorkflowProof,
|
|
1951
|
-
blocksPublishUntilReleaseGate: blocksPublishUntilReleaseGate,
|
|
1952
|
-
blocksWowUiUntilWorkflowProof: blocksWowUiUntilWorkflowProof,
|
|
1953
|
-
blockers: blockers
|
|
1954
|
-
}
|
|
1955
|
-
};
|
|
1956
|
-
}
|
|
1957
|
-
function adapterStatusPassed(value) {
|
|
1958
|
-
var normalized = cleanText(value, 120).toLowerCase();
|
|
1959
|
-
return !!normalized && /(pass|passed|success|succeeded|ok|done|complete|completed|ready|saved|published|deployed)/i.test(normalized);
|
|
1960
|
-
}
|
|
1961
|
-
function applyAICoderWorkflowProofGate(qa, readiness, now) {
|
|
1962
|
-
if (readiness.ready
|
|
1963
|
-
|| readiness.status === 'release_blocked'
|
|
1964
|
-
|| qa.outcome === 'infra_failed'
|
|
1965
|
-
|| qa.outcome === 'compile_failed'
|
|
1966
|
-
|| qa.outcome === 'route_failed'
|
|
1967
|
-
|| qa.outcome === 'business_assertion_failed') {
|
|
1968
|
-
return qa;
|
|
1969
|
-
}
|
|
1970
|
-
var gate = aicoderWorkflowProofReadinessGate(readiness, now);
|
|
1971
|
-
return __assign(__assign({}, qa), { outcome: qa.routeProbes.some(function (probe) { return adapterStatusPassed(probe.status); })
|
|
1972
|
-
? 'route_only_pass'
|
|
1973
|
-
: 'incomplete', gateResults: __spreadArray(__spreadArray([], __read(qa.gateResults.filter(function (existing) { return !(existing.key === 'qa_business_assertion' && existing.status === 'pass'); })), false), [
|
|
1974
|
-
gate
|
|
1975
|
-
], false) });
|
|
1976
|
-
}
|
|
1977
|
-
function assistantQualityObject(input) {
|
|
1978
|
-
var _a, _b;
|
|
1979
|
-
var conversation = input.conversation || {};
|
|
1980
|
-
var latestAssistantMessage = __spreadArray([], __read(asArray(input.messages)), false).reverse()
|
|
1981
|
-
.find(function (message) { return /assistant/i.test(cleanText(message.role || message.authorRole || message.type, 80)); });
|
|
1982
|
-
return plainObject(input.answerQuality
|
|
1983
|
-
|| conversation.answerQuality
|
|
1984
|
-
|| conversation.answer_quality
|
|
1985
|
-
|| conversation.assistantAnswerQuality
|
|
1986
|
-
|| conversation.assistant_answer_quality
|
|
1987
|
-
|| (latestAssistantMessage === null || latestAssistantMessage === void 0 ? void 0 : latestAssistantMessage.answerQuality)
|
|
1988
|
-
|| (latestAssistantMessage === null || latestAssistantMessage === void 0 ? void 0 : latestAssistantMessage.answer_quality)
|
|
1989
|
-
|| ((_a = latestAssistantMessage === null || latestAssistantMessage === void 0 ? void 0 : latestAssistantMessage.metadata) === null || _a === void 0 ? void 0 : _a.answerQuality)
|
|
1990
|
-
|| ((_b = latestAssistantMessage === null || latestAssistantMessage === void 0 ? void 0 : latestAssistantMessage.metadata) === null || _b === void 0 ? void 0 : _b.answer_quality));
|
|
1991
|
-
}
|
|
1992
|
-
function assistantConfidenceLevel(value) {
|
|
1993
|
-
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();
|
|
1994
|
-
if (/^high$/.test(normalized)) {
|
|
1995
|
-
return 'high';
|
|
1996
|
-
}
|
|
1997
|
-
if (/^medium$/.test(normalized)) {
|
|
1998
|
-
return 'medium';
|
|
1999
|
-
}
|
|
2000
|
-
if (/^low$/.test(normalized)) {
|
|
2001
|
-
return 'low';
|
|
2002
|
-
}
|
|
2003
|
-
return 'unknown';
|
|
2004
|
-
}
|
|
2005
|
-
function assistantQueryStatus(value) {
|
|
2006
|
-
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, '_');
|
|
2007
|
-
if (/^(ok|success|answered|data_found|data)$/.test(normalized)) {
|
|
2008
|
-
return 'ok';
|
|
2009
|
-
}
|
|
2010
|
-
if (/^(no_data|no_results|empty|not_found)$/.test(normalized)) {
|
|
2011
|
-
return 'no_data';
|
|
2012
|
-
}
|
|
2013
|
-
if (/^(query_error|mongo_error|error|failed)$/.test(normalized)) {
|
|
2014
|
-
return 'query_error';
|
|
2015
|
-
}
|
|
2016
|
-
if (/^(permission_error|permission_denied|forbidden|unauthorized)$/.test(normalized)) {
|
|
2017
|
-
return 'permission_error';
|
|
2018
|
-
}
|
|
2019
|
-
return 'unknown';
|
|
2020
|
-
}
|
|
2021
|
-
function asObjectList(value) {
|
|
2022
|
-
return asArray(value).filter(function (entry) { return entry && typeof entry === 'object' && !Array.isArray(entry); });
|
|
2023
|
-
}
|
|
2024
|
-
function assistantEvidenceRefs(quality) {
|
|
2025
|
-
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);
|
|
2026
|
-
}
|
|
2027
|
-
function assistantCitationRefs(quality) {
|
|
2028
|
-
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);
|
|
2029
|
-
}
|
|
2030
|
-
function assistantQueryExecutions(quality) {
|
|
2031
|
-
var queryExecution = plainObject(quality.queryExecution || quality.query_execution);
|
|
2032
|
-
var toolResult = plainObject(quality.toolResult || quality.tool_result);
|
|
2033
|
-
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; });
|
|
2034
|
-
}
|
|
2035
|
-
function assistantQueryEvidenceRefs(quality, executions) {
|
|
2036
|
-
if (executions === void 0) { executions = assistantQueryExecutions(quality); }
|
|
2037
|
-
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) {
|
|
2038
|
-
return execution.id
|
|
2039
|
-
|| execution._id
|
|
2040
|
-
|| execution.ref
|
|
2041
|
-
|| execution.toolResultId
|
|
2042
|
-
|| execution.tool_result_id
|
|
2043
|
-
|| execution.toolCallId
|
|
2044
|
-
|| execution.tool_call_id
|
|
2045
|
-
|| execution.artifactPath
|
|
2046
|
-
|| execution.artifact_path
|
|
2047
|
-
|| execution.path
|
|
2048
|
-
|| execution.url;
|
|
2049
|
-
})), false), 80, 500);
|
|
2050
|
-
}
|
|
2051
|
-
function assistantNextActions(quality) {
|
|
2052
|
-
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);
|
|
2053
|
-
}
|
|
2054
|
-
function normalizedIsoDay(value) {
|
|
2055
|
-
if (!value) {
|
|
2056
|
-
return '';
|
|
2057
|
-
}
|
|
2058
|
-
var date = value instanceof Date ? value : new Date(value);
|
|
2059
|
-
if (!Number.isFinite(date.getTime())) {
|
|
2060
|
-
return cleanText(value, 40).slice(0, 10);
|
|
2061
|
-
}
|
|
2062
|
-
return date.toISOString().slice(0, 10);
|
|
2063
|
-
}
|
|
2064
|
-
function assistantDateWindowObject(quality) {
|
|
2065
|
-
var _a, _b, _c;
|
|
2066
|
-
var dateWindow = plainObject(quality.dateWindow || quality.date_window);
|
|
2067
|
-
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));
|
|
2068
|
-
return Object.keys(dateWindow).length ? dateWindow : nestedWindow;
|
|
2069
|
-
}
|
|
2070
|
-
function collectMongoProjectionObjects(value, result) {
|
|
2071
|
-
var e_27, _a;
|
|
2072
|
-
if (result === void 0) { result = []; }
|
|
2073
|
-
if (!value || typeof value !== 'object') {
|
|
2074
|
-
return result;
|
|
2075
|
-
}
|
|
2076
|
-
if (Array.isArray(value)) {
|
|
2077
|
-
try {
|
|
2078
|
-
for (var value_2 = __values(value), value_2_1 = value_2.next(); !value_2_1.done; value_2_1 = value_2.next()) {
|
|
2079
|
-
var entry = value_2_1.value;
|
|
2080
|
-
collectMongoProjectionObjects(entry, result);
|
|
2081
|
-
}
|
|
2082
|
-
}
|
|
2083
|
-
catch (e_27_1) { e_27 = { error: e_27_1 }; }
|
|
2084
|
-
finally {
|
|
2085
|
-
try {
|
|
2086
|
-
if (value_2_1 && !value_2_1.done && (_a = value_2.return)) _a.call(value_2);
|
|
2087
|
-
}
|
|
2088
|
-
finally { if (e_27) throw e_27.error; }
|
|
2089
|
-
}
|
|
2090
|
-
return result;
|
|
2091
|
-
}
|
|
2092
|
-
if (value.projection && typeof value.projection === 'object' && !Array.isArray(value.projection)) {
|
|
2093
|
-
result.push(value.projection);
|
|
2094
|
-
}
|
|
2095
|
-
if (value.options && typeof value.options === 'object' && !Array.isArray(value.options) && value.options.projection) {
|
|
2096
|
-
collectMongoProjectionObjects({ projection: value.options.projection }, result);
|
|
2097
|
-
}
|
|
2098
|
-
if (value.query && typeof value.query === 'object') {
|
|
2099
|
-
collectMongoProjectionObjects(value.query, result);
|
|
2100
|
-
}
|
|
2101
|
-
if (value.mongoQuery && typeof value.mongoQuery === 'object') {
|
|
2102
|
-
collectMongoProjectionObjects(value.mongoQuery, result);
|
|
2103
|
-
}
|
|
2104
|
-
if (value.mongo_query && typeof value.mongo_query === 'object') {
|
|
2105
|
-
collectMongoProjectionObjects(value.mongo_query, result);
|
|
2106
|
-
}
|
|
2107
|
-
return result;
|
|
2108
|
-
}
|
|
2109
|
-
function projectionHasPositionalOperator(projection) {
|
|
2110
|
-
return Object.keys(projection || {}).some(function (key) { return /\.(?:\$|\$\[)|\.\$$/.test(key); });
|
|
2111
|
-
}
|
|
2112
|
-
function assistantQueryShapeLegal(quality) {
|
|
2113
|
-
if (quality.legalQueryShape === true || quality.legal_query_shape === true) {
|
|
2114
|
-
return true;
|
|
2115
|
-
}
|
|
2116
|
-
if (quality.legalQueryShape === false || quality.legal_query_shape === false || quality.illegalQueryShape === true || quality.illegal_query_shape === true) {
|
|
2117
|
-
return false;
|
|
2118
|
-
}
|
|
2119
|
-
var queryShape = plainObject(quality.queryShape || quality.query_shape);
|
|
2120
|
-
if (queryShape.legal === true || queryShape.status === 'pass') {
|
|
2121
|
-
return true;
|
|
2122
|
-
}
|
|
2123
|
-
if (queryShape.legal === false || queryShape.status === 'fail') {
|
|
2124
|
-
return false;
|
|
2125
|
-
}
|
|
2126
|
-
var projections = collectMongoProjectionObjects(quality);
|
|
2127
|
-
if (projections.some(projectionHasPositionalOperator)) {
|
|
2128
|
-
return false;
|
|
2129
|
-
}
|
|
2130
|
-
return true;
|
|
2131
|
-
}
|
|
2132
|
-
function assistantCorrectnessFailed(checks) {
|
|
2133
|
-
return checks
|
|
2134
|
-
.filter(function (check) {
|
|
2135
|
-
var status = cleanText(check.status || (check.passed === true ? 'pass' : check.passed === false ? 'fail' : ''), 80).toLowerCase();
|
|
2136
|
-
return /^(fail|failed|blocked|incorrect|wrong|error)$/.test(status);
|
|
2137
|
-
})
|
|
2138
|
-
.map(function (check) { return cleanText(check.assertion || check.name || check.case || check.reason || 'assistant correctness check failed', 300); })
|
|
2139
|
-
.slice(0, 20);
|
|
2140
|
-
}
|
|
2141
|
-
function evaluateAssistantAnswerQuality(input) {
|
|
2142
|
-
var _a, _b;
|
|
2143
|
-
if (input === void 0) { input = {}; }
|
|
2144
|
-
var quality = plainObject(input.answerQuality);
|
|
2145
|
-
var now = isoNow(input.now);
|
|
2146
|
-
var correctnessChecks = asArray(input.correctnessChecks);
|
|
2147
|
-
var failedChecks = assistantCorrectnessFailed(correctnessChecks);
|
|
2148
|
-
var queryStatus = assistantQueryStatus(quality.queryStatus || quality.query_status || quality.queryResult || quality.query_result);
|
|
2149
|
-
var confidenceLevel = assistantConfidenceLevel(quality.confidence || quality.confidenceLevel || quality.confidence_level);
|
|
2150
|
-
var evidenceRefs = assistantEvidenceRefs(quality);
|
|
2151
|
-
var citationRefs = assistantCitationRefs(quality);
|
|
2152
|
-
var queryExecutions = assistantQueryExecutions(quality);
|
|
2153
|
-
var queryEvidenceRefs = assistantQueryEvidenceRefs(quality, queryExecutions);
|
|
2154
|
-
var nextActions = assistantNextActions(quality);
|
|
2155
|
-
var requiresCurrentDate = quality.requiresCurrentDate === true || quality.requires_current_date === true;
|
|
2156
|
-
var dateWindowRequired = quality.requiresDateWindow === true
|
|
2157
|
-
|| quality.requires_date_window === true
|
|
2158
|
-
|| quality.dateWindowRequired === true
|
|
2159
|
-
|| quality.date_window_required === true;
|
|
2160
|
-
var requiresCitations = quality.requiresCitations !== false && quality.requires_citations !== false;
|
|
2161
|
-
var requiresNextAction = quality.requiresNextAction !== false && quality.requires_next_action !== false;
|
|
2162
|
-
var dateWindow = assistantDateWindowObject(quality);
|
|
2163
|
-
var dateWindowStart = cleanText(dateWindow.startDate || dateWindow.start_date || dateWindow.start, 80);
|
|
2164
|
-
var dateWindowEnd = cleanText(dateWindow.endDate || dateWindow.end_date || dateWindow.end, 80);
|
|
2165
|
-
var dateWindowPresent = !!dateWindowStart && !!dateWindowEnd;
|
|
2166
|
-
var dateBasis = cleanText(quality.currentDateUsed
|
|
2167
|
-
|| quality.current_date_used
|
|
2168
|
-
|| quality.dateBasis
|
|
2169
|
-
|| quality.date_basis
|
|
2170
|
-
|| ((_a = quality.dateWindow) === null || _a === void 0 ? void 0 : _a.basisDate)
|
|
2171
|
-
|| ((_b = quality.date_window) === null || _b === void 0 ? void 0 : _b.basis_date), 80);
|
|
2172
|
-
var expectedCurrentDate = cleanText(quality.expectedCurrentDate || quality.expected_current_date, 80)
|
|
2173
|
-
|| normalizedIsoDay(input.now);
|
|
2174
|
-
var noDataConfirmed = quality.noDataConfirmed === true
|
|
2175
|
-
|| quality.no_data_confirmed === true
|
|
2176
|
-
|| quality.confirmedNoData === true
|
|
2177
|
-
|| quality.confirmed_no_data === true;
|
|
2178
|
-
var legalQueryShape = assistantQueryShapeLegal(quality);
|
|
2179
|
-
var queryEvidenceRequired = quality.requiresQueryEvidence !== false
|
|
2180
|
-
&& quality.requires_query_evidence !== false
|
|
2181
|
-
&& (queryStatus === 'ok' || queryStatus === 'no_data');
|
|
2182
|
-
var queryEvidencePresent = queryExecutions.length > 0 || queryEvidenceRefs.length > 0;
|
|
2183
|
-
var blockers = [];
|
|
2184
|
-
var status = 'ready';
|
|
2185
|
-
var reason = 'Assistant answer has structured data evidence, legal query shape, citations, confidence, and next action.';
|
|
2186
|
-
if (!Object.keys(quality).length) {
|
|
2187
|
-
status = 'missing_data_source';
|
|
2188
|
-
blockers.push('Assistant answerQuality evidence is missing.');
|
|
2189
|
-
reason = 'Assistant answer cannot be accepted without structured answerQuality evidence.';
|
|
2190
|
-
}
|
|
2191
|
-
else if (failedChecks.length) {
|
|
2192
|
-
status = 'incorrect';
|
|
2193
|
-
blockers.push.apply(blockers, __spreadArray([], __read(failedChecks), false));
|
|
2194
|
-
reason = 'Assistant correctness checks failed.';
|
|
2195
|
-
}
|
|
2196
|
-
else if (queryStatus === 'permission_error') {
|
|
2197
|
-
status = 'permission_error';
|
|
2198
|
-
blockers.push('Assistant data query was blocked by permission or authorization.');
|
|
2199
|
-
reason = 'Assistant must report permission-error state and avoid claiming no data or success.';
|
|
2200
|
-
}
|
|
2201
|
-
else if (queryStatus === 'query_error') {
|
|
2202
|
-
status = 'query_error';
|
|
2203
|
-
blockers.push('Assistant data query failed.');
|
|
2204
|
-
reason = 'Assistant must report query-error state and avoid claiming no data or success.';
|
|
2205
|
-
}
|
|
2206
|
-
else if (!legalQueryShape) {
|
|
2207
|
-
status = 'illegal_query_shape';
|
|
2208
|
-
blockers.push('Assistant query shape is illegal or uses an unsafe Mongo projection shape.');
|
|
2209
|
-
reason = 'Assistant must use legal Mongo query/projection shapes before answering.';
|
|
2210
|
-
}
|
|
2211
|
-
else if (requiresCurrentDate && (!dateBasis || normalizedIsoDay(dateBasis) !== normalizedIsoDay(expectedCurrentDate))) {
|
|
2212
|
-
status = 'date_incorrect';
|
|
2213
|
-
blockers.push("Expected current date ".concat(normalizedIsoDay(expectedCurrentDate) || expectedCurrentDate, ", got ").concat(dateBasis || 'missing date basis', "."));
|
|
2214
|
-
reason = 'Assistant answer did not prove it used the actual current date.';
|
|
2215
|
-
}
|
|
2216
|
-
else if (dateWindowRequired && !dateWindowPresent) {
|
|
2217
|
-
status = 'missing_date_window';
|
|
2218
|
-
blockers.push('Assistant dated answer did not record concrete date-window start and end evidence.');
|
|
2219
|
-
reason = 'Assistant dated answers must record the exact query date window used.';
|
|
2220
|
-
}
|
|
2221
|
-
else if (queryStatus === 'unknown') {
|
|
2222
|
-
status = 'missing_data_source';
|
|
2223
|
-
blockers.push('Assistant answer did not record queryStatus ok/no_data/query_error/permission_error.');
|
|
2224
|
-
reason = 'Assistant answer must classify data access result before acceptance.';
|
|
2225
|
-
}
|
|
2226
|
-
else if (queryStatus === 'no_data' && !noDataConfirmed) {
|
|
2227
|
-
status = 'no_data_unverified';
|
|
2228
|
-
blockers.push('No-data answer was not confirmed by a probe or query evidence.');
|
|
2229
|
-
reason = 'Assistant no-data answers require explicit noDataConfirmed evidence.';
|
|
2230
|
-
}
|
|
2231
|
-
else if (queryEvidenceRequired && !queryEvidencePresent) {
|
|
2232
|
-
status = 'missing_query_proof';
|
|
2233
|
-
blockers.push('Assistant data answer did not record a structured query execution, tool result, or query evidence reference.');
|
|
2234
|
-
reason = 'Assistant answers from system data require structured query/tool execution proof before acceptance.';
|
|
2235
|
-
}
|
|
2236
|
-
else if (requiresCitations && !citationRefs.length && !evidenceRefs.length) {
|
|
2237
|
-
status = 'missing_citations';
|
|
2238
|
-
blockers.push('Assistant answer has no cited evidence or artifact reference.');
|
|
2239
|
-
reason = 'Assistant answer must cite system data evidence.';
|
|
2240
|
-
}
|
|
2241
|
-
else if (confidenceLevel === 'low' || confidenceLevel === 'unknown') {
|
|
2242
|
-
status = 'low_confidence';
|
|
2243
|
-
blockers.push('Assistant answer confidence is low or unknown.');
|
|
2244
|
-
reason = 'Assistant answer requires recorded medium/high confidence.';
|
|
2245
|
-
}
|
|
2246
|
-
else if (requiresNextAction && !nextActions.length) {
|
|
2247
|
-
status = 'missing_next_action';
|
|
2248
|
-
blockers.push('Assistant answer did not record next actions.');
|
|
2249
|
-
reason = 'Assistant answer must provide a next action or explicit no-action state.';
|
|
2250
|
-
}
|
|
2251
|
-
return {
|
|
2252
|
-
ready: status === 'ready',
|
|
2253
|
-
status: status,
|
|
2254
|
-
reason: reason,
|
|
2255
|
-
blockers: blockers,
|
|
2256
|
-
queryStatus: queryStatus,
|
|
2257
|
-
confidenceLevel: confidenceLevel,
|
|
2258
|
-
dateBasis: dateBasis || undefined,
|
|
2259
|
-
expectedCurrentDate: expectedCurrentDate || undefined,
|
|
2260
|
-
dateWindowRequired: dateWindowRequired,
|
|
2261
|
-
dateWindowPresent: dateWindowPresent,
|
|
2262
|
-
dateWindow: dateWindowPresent ? {
|
|
2263
|
-
startDate: dateWindowStart,
|
|
2264
|
-
endDate: dateWindowEnd,
|
|
2265
|
-
mode: cleanText(dateWindow.mode || dateWindow.type, 80) || undefined,
|
|
2266
|
-
months: typeof dateWindow.months === 'number' ? dateWindow.months : undefined
|
|
2267
|
-
} : undefined,
|
|
2268
|
-
noDataConfirmed: noDataConfirmed,
|
|
2269
|
-
legalQueryShape: legalQueryShape,
|
|
2270
|
-
citationRefs: citationRefs,
|
|
2271
|
-
queryEvidenceRequired: queryEvidenceRequired,
|
|
2272
|
-
queryEvidencePresent: queryEvidencePresent,
|
|
2273
|
-
queryEvidenceRefs: queryEvidenceRefs,
|
|
2274
|
-
queryExecutionCount: queryExecutions.length,
|
|
2275
|
-
nextActions: nextActions,
|
|
2276
|
-
evidenceRefs: evidenceRefs,
|
|
2277
|
-
failedChecks: failedChecks,
|
|
2278
|
-
recordedAt: now
|
|
2279
|
-
};
|
|
2280
|
-
}
|
|
2281
|
-
function assistantAnswerQualityGate(decision, now) {
|
|
2282
|
-
var status = decision.ready
|
|
2283
|
-
? 'pass'
|
|
2284
|
-
: /incorrect|date_incorrect|missing_date_window|illegal_query_shape/.test(decision.status)
|
|
2285
|
-
? 'fail'
|
|
2286
|
-
: 'blocked';
|
|
2287
|
-
return {
|
|
2288
|
-
key: 'assistant_answer_quality',
|
|
2289
|
-
label: 'Assistant answer quality',
|
|
2290
|
-
status: status,
|
|
2291
|
-
reason: decision.reason,
|
|
2292
|
-
evidenceRefs: decision.evidenceRefs.length ? decision.evidenceRefs : decision.citationRefs,
|
|
2293
|
-
recordedAt: isoNow(now || decision.recordedAt),
|
|
2294
|
-
metadata: {
|
|
2295
|
-
ready: decision.ready,
|
|
2296
|
-
status: decision.status,
|
|
2297
|
-
queryStatus: decision.queryStatus,
|
|
2298
|
-
confidenceLevel: decision.confidenceLevel,
|
|
2299
|
-
dateBasis: decision.dateBasis,
|
|
2300
|
-
expectedCurrentDate: decision.expectedCurrentDate,
|
|
2301
|
-
dateWindowRequired: decision.dateWindowRequired,
|
|
2302
|
-
dateWindowPresent: decision.dateWindowPresent,
|
|
2303
|
-
dateWindow: decision.dateWindow,
|
|
2304
|
-
noDataConfirmed: decision.noDataConfirmed,
|
|
2305
|
-
legalQueryShape: decision.legalQueryShape,
|
|
2306
|
-
citationRefs: decision.citationRefs,
|
|
2307
|
-
queryEvidenceRequired: decision.queryEvidenceRequired,
|
|
2308
|
-
queryEvidencePresent: decision.queryEvidencePresent,
|
|
2309
|
-
queryEvidenceRefs: decision.queryEvidenceRefs,
|
|
2310
|
-
queryExecutionCount: decision.queryExecutionCount,
|
|
2311
|
-
nextActions: decision.nextActions,
|
|
2312
|
-
blockers: decision.blockers,
|
|
2313
|
-
failedChecks: decision.failedChecks
|
|
2314
|
-
}
|
|
2315
|
-
};
|
|
2316
|
-
}
|
|
2317
|
-
function applyAssistantAnswerQualityGate(qa, decision, now) {
|
|
2318
|
-
var gate = assistantAnswerQualityGate(decision, now);
|
|
2319
|
-
if (decision.ready) {
|
|
2320
|
-
return __assign(__assign({}, qa), { gateResults: __spreadArray(__spreadArray([], __read(qa.gateResults), false), [gate], false) });
|
|
2321
|
-
}
|
|
2322
|
-
return __assign(__assign({}, qa), { outcome: /incorrect|date_incorrect|missing_date_window|illegal_query_shape/.test(decision.status)
|
|
2323
|
-
? 'business_assertion_failed'
|
|
2324
|
-
: 'incomplete', gateResults: __spreadArray(__spreadArray([], __read(qa.gateResults.filter(function (existing) { return !(existing.key === 'qa_business_assertion' && existing.status === 'pass'); })), false), [
|
|
2325
|
-
gate
|
|
2326
|
-
], false) });
|
|
2327
|
-
}
|
|
2328
|
-
function buildSupportAIRunFromEvidence(input) {
|
|
2329
|
-
var e_28, _a, e_29, _b;
|
|
2330
|
-
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;
|
|
2331
|
-
var ticket = input.ticket || {};
|
|
2332
|
-
var job = input.job || {};
|
|
2333
|
-
var evidence = buildSupportQaEvidence(input);
|
|
2334
|
-
var events = [];
|
|
2335
|
-
var gates = [];
|
|
2336
|
-
var sourceIds = {};
|
|
2337
|
-
addSourceId(sourceIds, 'ticketId', ticket._id || ticket.id || job.ticketId || job.supportTicketId);
|
|
2338
|
-
addSourceId(sourceIds, 'ticketNumber', ticket.ticketNumber || ticket.number || job.ticketNumber);
|
|
2339
|
-
addSourceId(sourceIds, 'jobId', job._id || job.id || job.jobId);
|
|
2340
|
-
addSourceId(sourceIds, 'buildPlanId', job.buildPlanId || ticket.buildPlanId);
|
|
2341
|
-
try {
|
|
2342
|
-
for (var _24 = __values(asArray(input.taskEvents)), _25 = _24.next(); !_25.done; _25 = _24.next()) {
|
|
2343
|
-
var event_1 = _25.value;
|
|
2344
|
-
pushEvent(events, {
|
|
2345
|
-
type: event_1.type === 'human_intervention' ? 'human_intervention' : 'log',
|
|
2346
|
-
category: cleanText(event_1.category || event_1.phase || event_1.type, 160),
|
|
2347
|
-
message: cleanText(event_1.message || event_1.summary || event_1.text || event_1.title, 1800),
|
|
2348
|
-
recordedAt: eventDate(event_1),
|
|
2349
|
-
metadata: {
|
|
2350
|
-
status: event_1.status,
|
|
2351
|
-
phase: event_1.phase,
|
|
2352
|
-
taskId: event_1.taskId || event_1._id || event_1.id
|
|
2353
|
-
}
|
|
2354
|
-
});
|
|
2355
|
-
}
|
|
2356
|
-
}
|
|
2357
|
-
catch (e_28_1) { e_28 = { error: e_28_1 }; }
|
|
2358
|
-
finally {
|
|
2359
|
-
try {
|
|
2360
|
-
if (_25 && !_25.done && (_a = _24.return)) _a.call(_24);
|
|
2361
|
-
}
|
|
2362
|
-
finally { if (e_28) throw e_28.error; }
|
|
2363
|
-
}
|
|
2364
|
-
try {
|
|
2365
|
-
for (var _26 = __values(asArray(input.aiJobs)), _27 = _26.next(); !_27.done; _27 = _26.next()) {
|
|
2366
|
-
var aiJob = _27.value;
|
|
2367
|
-
pushEvent(events, {
|
|
2368
|
-
type: aiJob.model ? 'model_call' : 'log',
|
|
2369
|
-
category: cleanText(aiJob.category || aiJob.phase || aiJob.runner, 160),
|
|
2370
|
-
message: cleanText(aiJob.summary || aiJob.promptSummary || aiJob.status || aiJob.phase, 1800),
|
|
2371
|
-
recordedAt: eventDate(aiJob),
|
|
2372
|
-
metadata: {
|
|
2373
|
-
id: aiJob._id || aiJob.id,
|
|
2374
|
-
model: aiJob.model,
|
|
2375
|
-
status: aiJob.status,
|
|
2376
|
-
phase: aiJob.phase
|
|
2377
|
-
}
|
|
2378
|
-
});
|
|
2379
|
-
}
|
|
2380
|
-
}
|
|
2381
|
-
catch (e_29_1) { e_29 = { error: e_29_1 }; }
|
|
2382
|
-
finally {
|
|
2383
|
-
try {
|
|
2384
|
-
if (_27 && !_27.done && (_b = _26.return)) _b.call(_26);
|
|
2385
|
-
}
|
|
2386
|
-
finally { if (e_29) throw e_29.error; }
|
|
2387
|
-
}
|
|
2388
|
-
collectCommitEvents(asArray(input.commits), events);
|
|
2389
|
-
collectHotfixEvidenceEvents([job, ticket, evidence, input.qaEvidence], events, gates, input.now);
|
|
2390
|
-
var noBlindLoopGate = supportManagerNoBlindLoopGate(job, evidence, input.now);
|
|
2391
|
-
if (noBlindLoopGate) {
|
|
2392
|
-
gates.push(noBlindLoopGate);
|
|
2393
|
-
pushEvent(events, {
|
|
2394
|
-
type: 'log',
|
|
2395
|
-
category: 'manager_no_blind_loop_policy',
|
|
2396
|
-
message: noBlindLoopGate.reason,
|
|
2397
|
-
artifactPaths: noBlindLoopGate.evidenceRefs,
|
|
2398
|
-
recordedAt: noBlindLoopGate.recordedAt,
|
|
2399
|
-
metadata: noBlindLoopGate.metadata
|
|
2400
|
-
});
|
|
2401
|
-
}
|
|
2402
|
-
var businessProofReadiness = plainObject(evidence.businessProofReadiness || evidence.business_proof_readiness);
|
|
2403
|
-
var businessProofReadinessGate = supportBusinessProofReadinessGate(businessProofReadiness, input.now);
|
|
2404
|
-
if (businessProofReadinessGate) {
|
|
2405
|
-
gates.push(businessProofReadinessGate);
|
|
2406
|
-
pushEvent(events, {
|
|
2407
|
-
type: 'qa_business_assertion',
|
|
2408
|
-
category: 'support_business_proof_readiness',
|
|
2409
|
-
message: businessProofReadinessGate.reason,
|
|
2410
|
-
artifactPaths: businessProofReadinessGate.evidenceRefs,
|
|
2411
|
-
recordedAt: businessProofReadinessGate.recordedAt,
|
|
2412
|
-
metadata: businessProofReadinessGate.metadata
|
|
2413
|
-
});
|
|
2414
|
-
}
|
|
2415
|
-
var customerReplyPolicy = plainObject(evidence.customerReplyPolicy || evidence.customer_reply_policy);
|
|
2416
|
-
var customerReplyPolicyGate = supportCustomerReplyPolicyGate(customerReplyPolicy, input.now);
|
|
2417
|
-
if (customerReplyPolicyGate) {
|
|
2418
|
-
gates.push(customerReplyPolicyGate);
|
|
2419
|
-
pushEvent(events, {
|
|
2420
|
-
type: 'human_intervention',
|
|
2421
|
-
category: 'support_customer_reply_policy',
|
|
2422
|
-
message: customerReplyPolicyGate.reason,
|
|
2423
|
-
artifactPaths: customerReplyPolicyGate.evidenceRefs,
|
|
2424
|
-
recordedAt: customerReplyPolicyGate.recordedAt,
|
|
2425
|
-
metadata: customerReplyPolicyGate.metadata
|
|
2426
|
-
});
|
|
2427
|
-
}
|
|
2428
|
-
var nextActionContract = supportNextActionContractObject(ticket, job, evidence);
|
|
2429
|
-
var nextActionContractRequired = supportNextActionContractRequired(ticket, job, evidence);
|
|
2430
|
-
var nextActionContractGate = supportNextActionContractGate(nextActionContract, input.now, nextActionContractRequired);
|
|
2431
|
-
if (nextActionContractGate) {
|
|
2432
|
-
gates.push(nextActionContractGate);
|
|
2433
|
-
pushEvent(events, {
|
|
2434
|
-
type: 'log',
|
|
2435
|
-
category: 'support_next_action_contract',
|
|
2436
|
-
message: nextActionContractGate.reason,
|
|
2437
|
-
artifactPaths: nextActionContractGate.evidenceRefs,
|
|
2438
|
-
recordedAt: nextActionContractGate.recordedAt,
|
|
2439
|
-
metadata: nextActionContractGate.metadata
|
|
2440
|
-
});
|
|
2441
|
-
}
|
|
2442
|
-
var ticketAutomation = plainObject(ticket.automation);
|
|
2443
|
-
var ticketManagerState = plainObject(ticketAutomation.manager || ticket.manager);
|
|
2444
|
-
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);
|
|
2445
|
-
var rootCauseEntryContractGate = supportRootCauseEntryContractGate(rootCauseEntryContract, input.now);
|
|
2446
|
-
if (rootCauseEntryContractGate) {
|
|
2447
|
-
gates.push(rootCauseEntryContractGate);
|
|
2448
|
-
pushEvent(events, {
|
|
2449
|
-
type: 'log',
|
|
2450
|
-
category: 'support_root_cause_entry_contract',
|
|
2451
|
-
message: rootCauseEntryContractGate.reason,
|
|
2452
|
-
artifactPaths: rootCauseEntryContractGate.evidenceRefs,
|
|
2453
|
-
recordedAt: rootCauseEntryContractGate.recordedAt,
|
|
2454
|
-
metadata: rootCauseEntryContractGate.metadata
|
|
2455
|
-
});
|
|
2456
|
-
}
|
|
2457
|
-
var cost = collectUsageEvents(asArray(input.usageLedger), events);
|
|
2458
|
-
var diagnosisGate = evidenceObject(job.supportV5DiagnosisGate, job.support_v5_diagnosis_gate, job.diagnosisGate, ticket.supportV5DiagnosisGate, ticket.diagnosisGate, evidence.diagnosisGate, evidence.supportV5DiagnosisGate);
|
|
2459
|
-
var diagnosisEvidencePackSource = supportDiagnosisEvidencePackObject(ticket, job, evidence);
|
|
2460
|
-
var similarFixHints = supportSimilarFixHintsObject(ticket, job, evidence);
|
|
2461
|
-
var diagnosisEvidencePack = Object.keys(diagnosisEvidencePackSource).length
|
|
2462
|
-
? diagnosisEvidencePackSource
|
|
2463
|
-
: (Object.keys(diagnosisGate).length || Object.keys(similarFixHints).length)
|
|
2464
|
-
? (0, support_runner_v5_1.buildResolveIOSupportDiagnosisEvidencePack)({
|
|
2465
|
-
diagnosisGate: diagnosisGate,
|
|
2466
|
-
similarCaseHints: similarFixHints,
|
|
2467
|
-
issueClass: diagnosisGate.issue_class || diagnosisGate.issueClass,
|
|
2468
|
-
ownerFiles: diagnosisGate.owner_files || diagnosisGate.ownerFiles,
|
|
2469
|
-
text: [
|
|
2470
|
-
ticket.title,
|
|
2471
|
-
ticket.subject,
|
|
2472
|
-
ticket.summary,
|
|
2473
|
-
job.title,
|
|
2474
|
-
job.summary
|
|
2475
|
-
].filter(Boolean).join(' '),
|
|
2476
|
-
now: input.now
|
|
2477
|
-
})
|
|
2478
|
-
: {};
|
|
2479
|
-
var diagnosisEvidencePackGate = supportDiagnosisEvidencePackGate(diagnosisEvidencePack, input.now);
|
|
2480
|
-
if (diagnosisEvidencePackGate) {
|
|
2481
|
-
gates.push(diagnosisEvidencePackGate);
|
|
2482
|
-
pushEvent(events, {
|
|
2483
|
-
type: 'log',
|
|
2484
|
-
category: 'support_diagnosis_evidence_pack',
|
|
2485
|
-
message: diagnosisEvidencePackGate.reason,
|
|
2486
|
-
artifactPaths: diagnosisEvidencePackGate.evidenceRefs,
|
|
2487
|
-
recordedAt: diagnosisEvidencePackGate.recordedAt,
|
|
2488
|
-
metadata: diagnosisEvidencePackGate.metadata
|
|
2489
|
-
});
|
|
2490
|
-
}
|
|
2491
|
-
var productRepairEvidence = supportProductRepairEvidence(input, evidence);
|
|
2492
|
-
var diagnosisBeforeRepairGate = supportDiagnosisBeforeRepairGate(diagnosisGate, productRepairEvidence, input.now);
|
|
2493
|
-
if (diagnosisBeforeRepairGate) {
|
|
2494
|
-
gates.push(diagnosisBeforeRepairGate);
|
|
2495
|
-
pushEvent(events, {
|
|
2496
|
-
type: 'log',
|
|
2497
|
-
category: 'support_diagnosis_before_repair',
|
|
2498
|
-
message: diagnosisBeforeRepairGate.reason,
|
|
2499
|
-
artifactPaths: diagnosisBeforeRepairGate.evidenceRefs,
|
|
2500
|
-
recordedAt: diagnosisBeforeRepairGate.recordedAt,
|
|
2501
|
-
metadata: diagnosisBeforeRepairGate.metadata
|
|
2502
|
-
});
|
|
2503
|
-
}
|
|
2504
|
-
var qa = applySupportDiagnosisProofGate(buildQaFromEvidence(evidence, input.now), diagnosisGate, input.now);
|
|
2505
|
-
var diagnosisOwnerFiles = asArray(diagnosisGate.owner_files || diagnosisGate.ownerFiles);
|
|
2506
|
-
var diagnosisIssueClass = cleanText(diagnosisGate.issue_class || diagnosisGate.issueClass, 120);
|
|
2507
|
-
if (Object.keys(diagnosisGate).length) {
|
|
2508
|
-
pushEvent(events, {
|
|
2509
|
-
type: 'log',
|
|
2510
|
-
category: 'diagnosis_gate',
|
|
2511
|
-
message: cleanText(((_c = diagnosisGate.accepted_hypothesis) === null || _c === void 0 ? void 0 : _c.statement) || ((_d = diagnosisGate.acceptedHypothesis) === null || _d === void 0 ? void 0 : _d.statement) || diagnosisGate.summary || 'Support diagnosis gate recorded.', 1800),
|
|
2512
|
-
metadata: {
|
|
2513
|
-
status: diagnosisGate.status,
|
|
2514
|
-
issueClass: diagnosisIssueClass,
|
|
2515
|
-
ownerFiles: diagnosisOwnerFiles
|
|
2516
|
-
}
|
|
2517
|
-
});
|
|
2518
|
-
}
|
|
2519
|
-
return (0, ai_run_evidence_1.buildAIRun)({
|
|
2520
|
-
source: 'support_ticket',
|
|
2521
|
-
sourceIds: sourceIds,
|
|
2522
|
-
title: firstText(ticket, ['title', 'subject', 'summary']) || firstText(job, ['title', 'summary']),
|
|
2523
|
-
status: firstText(job, ['status', 'state']) || firstText(ticket, ['status', 'state']),
|
|
2524
|
-
phase: firstText(job, ['phase', 'runnerPhase']),
|
|
2525
|
-
startedAt: dateValue(job, ['startedAt', 'createdAt']) || dateValue(ticket, ['createdAt']),
|
|
2526
|
-
completedAt: dateValue(job, ['completedAt', 'finishedAt', 'updatedAt']),
|
|
2527
|
-
events: events,
|
|
2528
|
-
gates: gates,
|
|
2529
|
-
qa: qa,
|
|
2530
|
-
cost: cost,
|
|
2531
|
-
scorecardPassed: evidence.scorecardPassed === true || evidence.scorecardStatus === 'pass',
|
|
2532
|
-
deployStatus: evidence.deployStatus,
|
|
2533
|
-
publishStatus: evidence.publishStatus,
|
|
2534
|
-
sampleDataStatus: evidence.sampleDataStatus,
|
|
2535
|
-
manualHandoff: evidence.manualHandoff === true || job.manualHandoff === true,
|
|
2536
|
-
stopped: evidence.stopped === true || job.stopped === true,
|
|
2537
|
-
rejected: evidence.rejected === true,
|
|
2538
|
-
explicitAccepted: evidence.explicitAccepted === true || ticket.accepted === true,
|
|
2539
|
-
terminal: /complete|closed|resolved|done|failed|rejected/i.test("".concat(job.status || '', " ").concat(ticket.status || '')),
|
|
2540
|
-
now: input.now,
|
|
2541
|
-
metadata: {
|
|
2542
|
-
versionCount: asArray(input.versions).length,
|
|
2543
|
-
buildPlanCount: asArray(input.buildPlans).length,
|
|
2544
|
-
managerNoBlindLoopPolicy: managerNoBlindLoopMetadata(noBlindLoopGate),
|
|
2545
|
-
diagnosisBeforeRepair: diagnosisBeforeRepairGate ? {
|
|
2546
|
-
status: diagnosisBeforeRepairGate.status,
|
|
2547
|
-
diagnosisValid: ((_e = diagnosisBeforeRepairGate.metadata) === null || _e === void 0 ? void 0 : _e.diagnosisValid) === true,
|
|
2548
|
-
diagnosisStatus: cleanText((_f = diagnosisBeforeRepairGate.metadata) === null || _f === void 0 ? void 0 : _f.diagnosisStatus, 120),
|
|
2549
|
-
activityCount: Number(((_g = diagnosisBeforeRepairGate.metadata) === null || _g === void 0 ? void 0 : _g.activityCount) || 0),
|
|
2550
|
-
changedFiles: cleanStringList((_h = diagnosisBeforeRepairGate.metadata) === null || _h === void 0 ? void 0 : _h.changedFiles, 40, 500),
|
|
2551
|
-
allowedDispatchAction: cleanText((_j = diagnosisBeforeRepairGate.metadata) === null || _j === void 0 ? void 0 : _j.allowedDispatchAction, 160),
|
|
2552
|
-
productRepairAllowed: ((_k = diagnosisBeforeRepairGate.metadata) === null || _k === void 0 ? void 0 : _k.productRepairAllowed) === true,
|
|
2553
|
-
blockers: cleanStringList((_l = diagnosisBeforeRepairGate.metadata) === null || _l === void 0 ? void 0 : _l.blockers, 20, 500)
|
|
2554
|
-
} : undefined,
|
|
2555
|
-
rootCauseEntryContract: Object.keys(rootCauseEntryContract).length ? {
|
|
2556
|
-
contractId: cleanText(rootCauseEntryContract.contract_id || rootCauseEntryContract.contractId, 160),
|
|
2557
|
-
version: cleanText(rootCauseEntryContract.version, 120),
|
|
2558
|
-
status: cleanText(rootCauseEntryContract.status, 120),
|
|
2559
|
-
issueClassProbeCount: asArray(rootCauseEntryContract.issue_class_probes || rootCauseEntryContract.issueClassProbes).length,
|
|
2560
|
-
ownerFileMax: Number(((_m = rootCauseEntryContract.owner_file_policy) === null || _m === void 0 ? void 0 : _m.max_files) || ((_o = rootCauseEntryContract.ownerFilePolicy) === null || _o === void 0 ? void 0 : _o.maxFiles) || 0) || 0,
|
|
2561
|
-
requiresBusinessAssertion: ((_p = rootCauseEntryContract.business_proof_policy) === null || _p === void 0 ? void 0 : _p.requires_aiqa_business_assertion) === true
|
|
2562
|
-
|| ((_q = rootCauseEntryContract.businessProofPolicy) === null || _q === void 0 ? void 0 : _q.requiresAiqaBusinessAssertion) === true
|
|
2563
|
-
} : undefined,
|
|
2564
|
-
diagnosis: Object.keys(diagnosisGate).length ? {
|
|
2565
|
-
status: cleanText(diagnosisGate.status, 80),
|
|
2566
|
-
issueClass: diagnosisIssueClass,
|
|
2567
|
-
ownerFiles: diagnosisOwnerFiles,
|
|
2568
|
-
acceptedHypothesis: cleanText(((_r = diagnosisGate.accepted_hypothesis) === null || _r === void 0 ? void 0 : _r.statement) || ((_s = diagnosisGate.acceptedHypothesis) === null || _s === void 0 ? void 0 : _s.statement), 1000),
|
|
2569
|
-
proofPlan: diagnosisGate.proof_plan || diagnosisGate.proofPlan
|
|
2570
|
-
} : undefined,
|
|
2571
|
-
diagnosisEvidencePack: diagnosisEvidencePackGate ? {
|
|
2572
|
-
status: cleanText((_t = diagnosisEvidencePackGate.metadata) === null || _t === void 0 ? void 0 : _t.status, 120),
|
|
2573
|
-
gateStatus: diagnosisEvidencePackGate.status,
|
|
2574
|
-
packId: cleanText((_u = diagnosisEvidencePackGate.metadata) === null || _u === void 0 ? void 0 : _u.packId, 180),
|
|
2575
|
-
readOnly: ((_v = diagnosisEvidencePackGate.metadata) === null || _v === void 0 ? void 0 : _v.readOnly) !== false,
|
|
2576
|
-
sourceEditsAllowed: ((_w = diagnosisEvidencePackGate.metadata) === null || _w === void 0 ? void 0 : _w.sourceEditsAllowed) === true,
|
|
2577
|
-
requiredOutputKey: cleanText((_x = diagnosisEvidencePackGate.metadata) === null || _x === void 0 ? void 0 : _x.requiredOutputKey, 120),
|
|
2578
|
-
diagnosisValid: ((_y = diagnosisEvidencePackGate.metadata) === null || _y === void 0 ? void 0 : _y.diagnosisValid) === true,
|
|
2579
|
-
issueClassHint: cleanText((_z = diagnosisEvidencePackGate.metadata) === null || _z === void 0 ? void 0 : _z.issueClassHint, 120),
|
|
2580
|
-
ownerFileHints: cleanStringList((_0 = diagnosisEvidencePackGate.metadata) === null || _0 === void 0 ? void 0 : _0.ownerFileHints, 20, 500),
|
|
2581
|
-
similarHintCount: Number(((_1 = diagnosisEvidencePackGate.metadata) === null || _1 === void 0 ? void 0 : _1.similarHintCount) || 0),
|
|
2582
|
-
similarHintsAdvisoryOnly: ((_2 = diagnosisEvidencePackGate.metadata) === null || _2 === void 0 ? void 0 : _2.similarHintsAdvisoryOnly) === true,
|
|
2583
|
-
issueClassProbeCount: Number(((_3 = diagnosisEvidencePackGate.metadata) === null || _3 === void 0 ? void 0 : _3.issueClassProbeCount) || 0),
|
|
2584
|
-
validationBlockers: cleanStringList((_4 = diagnosisEvidencePackGate.metadata) === null || _4 === void 0 ? void 0 : _4.validationBlockers, 20, 500)
|
|
2585
|
-
} : undefined,
|
|
2586
|
-
businessProofReadiness: Object.keys(businessProofReadiness).length ? {
|
|
2587
|
-
ready: businessProofReadiness.ready === true,
|
|
2588
|
-
status: cleanText(businessProofReadiness.status, 120),
|
|
2589
|
-
reason: cleanText(businessProofReadiness.reason, 1000),
|
|
2590
|
-
blockers: cleanStringList(businessProofReadiness.blockers, 20, 500)
|
|
2591
|
-
} : undefined,
|
|
2592
|
-
nextActionContract: nextActionContractGate ? {
|
|
2593
|
-
status: nextActionContractGate.status,
|
|
2594
|
-
action: cleanText((_5 = nextActionContractGate.metadata) === null || _5 === void 0 ? void 0 : _5.action, 160),
|
|
2595
|
-
primaryCommand: cleanText((_6 = nextActionContractGate.metadata) === null || _6 === void 0 ? void 0 : _6.primaryCommand, 240),
|
|
2596
|
-
safeToAutoRun: ((_7 = nextActionContractGate.metadata) === null || _7 === void 0 ? void 0 : _7.safeToAutoRun) === true,
|
|
2597
|
-
canRunWithoutCodexMonitor: ((_8 = nextActionContractGate.metadata) === null || _8 === void 0 ? void 0 : _8.canRunWithoutCodexMonitor) === true,
|
|
2598
|
-
codexFallbackRequired: ((_9 = nextActionContractGate.metadata) === null || _9 === void 0 ? void 0 : _9.codexFallbackRequired) === true,
|
|
2599
|
-
requiresHumanApproval: ((_10 = nextActionContractGate.metadata) === null || _10 === void 0 ? void 0 : _10.requiresHumanApproval) === true,
|
|
2600
|
-
rootCauseFirstSatisfied: ((_11 = nextActionContractGate.metadata) === null || _11 === void 0 ? void 0 : _11.rootCauseFirstSatisfied) === true,
|
|
2601
|
-
hotfixCommitRequired: ((_12 = nextActionContractGate.metadata) === null || _12 === void 0 ? void 0 : _12.hotfixCommitRequired) === true,
|
|
2602
|
-
liveHotfixBlockedUntilCommit: ((_13 = nextActionContractGate.metadata) === null || _13 === void 0 ? void 0 : _13.liveHotfixBlockedUntilCommit) === true,
|
|
2603
|
-
failureClass: cleanText((_14 = nextActionContractGate.metadata) === null || _14 === void 0 ? void 0 : _14.failureClass, 120),
|
|
2604
|
-
evidenceFreshnessStatus: cleanText((_15 = nextActionContractGate.metadata) === null || _15 === void 0 ? void 0 : _15.evidenceFreshnessStatus, 120),
|
|
2605
|
-
sameFailureCount: Number(((_16 = nextActionContractGate.metadata) === null || _16 === void 0 ? void 0 : _16.sameFailureCount) || 0),
|
|
2606
|
-
blockers: cleanStringList((_17 = nextActionContractGate.metadata) === null || _17 === void 0 ? void 0 : _17.blockers, 20, 500)
|
|
2607
|
-
} : undefined,
|
|
2608
|
-
customerReplyPolicy: Object.keys(customerReplyPolicy).length ? {
|
|
2609
|
-
action: cleanText(customerReplyPolicy.action, 120),
|
|
2610
|
-
safety: cleanText(customerReplyPolicy.safety, 120),
|
|
2611
|
-
canDraftCustomerReply: customerReplyPolicy.canDraftCustomerReply === true || customerReplyPolicy.can_draft_customer_reply === true,
|
|
2612
|
-
canSendCustomerReply: customerReplyPolicy.canSendCustomerReply === true || customerReplyPolicy.can_send_customer_reply === true,
|
|
2613
|
-
reason: cleanText(customerReplyPolicy.reason, 1000),
|
|
2614
|
-
reviewType: cleanText(((_18 = customerReplyPolicy.humanReviewPacket) === null || _18 === void 0 ? void 0 : _18.reviewType)
|
|
2615
|
-
|| ((_19 = customerReplyPolicy.human_review_packet) === null || _19 === void 0 ? void 0 : _19.review_type)
|
|
2616
|
-
|| ((_20 = customerReplyPolicy.human_review_packet) === null || _20 === void 0 ? void 0 : _20.reviewType), 160),
|
|
2617
|
-
primaryAction: cleanText(((_21 = customerReplyPolicy.humanReviewPacket) === null || _21 === void 0 ? void 0 : _21.primaryAction)
|
|
2618
|
-
|| ((_22 = customerReplyPolicy.human_review_packet) === null || _22 === void 0 ? void 0 : _22.primary_action)
|
|
2619
|
-
|| ((_23 = customerReplyPolicy.human_review_packet) === null || _23 === void 0 ? void 0 : _23.primaryAction), 160)
|
|
2620
|
-
} : undefined
|
|
2621
|
-
}
|
|
2622
|
-
});
|
|
2623
|
-
}
|
|
2624
|
-
function buildAICoderAIRunFromEvidence(input) {
|
|
2625
|
-
var e_30, _a;
|
|
2626
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
2627
|
-
var app = input.app || {};
|
|
2628
|
-
var job = input.job || {};
|
|
2629
|
-
var evidence = buildAICoderQaEvidence(input);
|
|
2630
|
-
var events = [];
|
|
2631
|
-
var gates = [];
|
|
2632
|
-
var sourceIds = {};
|
|
2633
|
-
addSourceId(sourceIds, 'appId', app._id || app.id || job.appId || job.aicoderAppId);
|
|
2634
|
-
addSourceId(sourceIds, 'jobId', job._id || job.id || job.jobId);
|
|
2635
|
-
addSourceId(sourceIds, 'domain', app.domain || app.customDomain || job.domain);
|
|
2636
|
-
try {
|
|
2637
|
-
for (var _v = __values(asArray(input.logs)), _w = _v.next(); !_w.done; _w = _v.next()) {
|
|
2638
|
-
var log = _w.value;
|
|
2639
|
-
pushEvent(events, {
|
|
2640
|
-
type: log.type === 'scorecard' ? 'scorecard' : 'log',
|
|
2641
|
-
category: cleanText(log.category || log.phase || log.level, 160),
|
|
2642
|
-
message: cleanText(log.message || log.summary || log.text || log.title, 1800),
|
|
2643
|
-
artifactPaths: asArray(log.artifactPaths || log.artifacts),
|
|
2644
|
-
recordedAt: eventDate(log),
|
|
2645
|
-
metadata: {
|
|
2646
|
-
status: log.status,
|
|
2647
|
-
level: log.level,
|
|
2648
|
-
score: log.score
|
|
2649
|
-
}
|
|
2650
|
-
});
|
|
2651
|
-
}
|
|
2652
|
-
}
|
|
2653
|
-
catch (e_30_1) { e_30 = { error: e_30_1 }; }
|
|
2654
|
-
finally {
|
|
2655
|
-
try {
|
|
2656
|
-
if (_w && !_w.done && (_a = _v.return)) _a.call(_v);
|
|
2657
|
-
}
|
|
2658
|
-
finally { if (e_30) throw e_30.error; }
|
|
2659
|
-
}
|
|
2660
|
-
collectCommitEvents(asArray(input.commits), events);
|
|
2661
|
-
collectHotfixEvidenceEvents([job, app, evidence, input.qaEvidence], events, gates, input.now);
|
|
2662
|
-
var noBlindLoopGate = aicoderManagerNoBlindLoopGate(app, job, evidence, input.now);
|
|
2663
|
-
if (noBlindLoopGate) {
|
|
2664
|
-
gates.push(noBlindLoopGate);
|
|
2665
|
-
pushEvent(events, {
|
|
2666
|
-
type: 'log',
|
|
2667
|
-
category: 'manager_no_blind_loop_policy',
|
|
2668
|
-
message: noBlindLoopGate.reason,
|
|
2669
|
-
artifactPaths: noBlindLoopGate.evidenceRefs,
|
|
2670
|
-
recordedAt: noBlindLoopGate.recordedAt,
|
|
2671
|
-
metadata: noBlindLoopGate.metadata
|
|
2672
|
-
});
|
|
2673
|
-
}
|
|
2674
|
-
var cost = collectUsageEvents(asArray(input.usageLedger), events);
|
|
2675
|
-
var scorecardPassed = evidence.scorecardPassed === true
|
|
2676
|
-
|| evidence.scorecardStatus === 'pass'
|
|
2677
|
-
|| (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));
|
|
2678
|
-
var explicitWorkflowReadiness = normalizeAICoderWorkflowProofReadiness(plainObject(evidence.workflowProofReadiness
|
|
2679
|
-
|| evidence.workflow_proof_readiness
|
|
2680
|
-
|| evidence.aicoderWorkflowProofReadiness
|
|
2681
|
-
|| evidence.aicoder_workflow_proof_readiness
|
|
2682
|
-
|| job.workflowProofReadiness
|
|
2683
|
-
|| job.workflow_proof_readiness
|
|
2684
|
-
|| job.aicoderWorkflowProofReadiness
|
|
2685
|
-
|| job.aicoder_workflow_proof_readiness), input.now);
|
|
2686
|
-
var workflowReadiness = explicitWorkflowReadiness || (0, aicoder_runner_v6_1.evaluateResolveIOAICoderWorkflowProofReadiness)({
|
|
2687
|
-
journeyContract: evidence.journeyContract,
|
|
2688
|
-
journeyContractMarkdown: evidence.journeyContractMarkdown,
|
|
2689
|
-
workflowQaRows: asArray(evidence.workflowQaRows || evidence.workflow_qa_rows),
|
|
2690
|
-
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),
|
|
2691
|
-
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),
|
|
2692
|
-
artifactPaths: __spreadArray(__spreadArray([], __read(asArray(evidence.artifactPaths)), false), __read(asArray(evidence.artifact_paths)), false),
|
|
2693
|
-
scorecardPassed: scorecardPassed,
|
|
2694
|
-
deployStatus: evidence.deployStatus,
|
|
2695
|
-
publishStatus: evidence.publishStatus,
|
|
2696
|
-
sampleDataStatus: evidence.sampleDataStatus,
|
|
2697
|
-
previousWorkflowProofFingerprint: firstNonEmptyText([
|
|
2698
|
-
evidence.previousWorkflowProofFingerprint,
|
|
2699
|
-
evidence.previous_workflow_proof_fingerprint,
|
|
2700
|
-
job.previousWorkflowProofFingerprint,
|
|
2701
|
-
job.previous_workflow_proof_fingerprint,
|
|
2702
|
-
app.previousWorkflowProofFingerprint,
|
|
2703
|
-
app.previous_workflow_proof_fingerprint
|
|
2704
|
-
], 200),
|
|
2705
|
-
previousArtifactFingerprint: firstNonEmptyText([
|
|
2706
|
-
evidence.previousArtifactFingerprint,
|
|
2707
|
-
evidence.previous_artifact_fingerprint,
|
|
2708
|
-
job.previousArtifactFingerprint,
|
|
2709
|
-
job.previous_artifact_fingerprint,
|
|
2710
|
-
app.previousArtifactFingerprint,
|
|
2711
|
-
app.previous_artifact_fingerprint
|
|
2712
|
-
], 200),
|
|
2713
|
-
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),
|
|
2714
|
-
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),
|
|
2715
|
-
now: input.now
|
|
2716
|
-
});
|
|
2717
|
-
var workflowReadinessGate = aicoderWorkflowProofReadinessGate(workflowReadiness, input.now);
|
|
2718
|
-
gates.push(workflowReadinessGate);
|
|
2719
|
-
pushEvent(events, {
|
|
2720
|
-
type: 'qa_business_assertion',
|
|
2721
|
-
category: 'aicoder_workflow_proof_readiness',
|
|
2722
|
-
message: workflowReadinessGate.reason,
|
|
2723
|
-
artifactPaths: workflowReadinessGate.evidenceRefs,
|
|
2724
|
-
recordedAt: workflowReadinessGate.recordedAt,
|
|
2725
|
-
metadata: workflowReadinessGate.metadata
|
|
2726
|
-
});
|
|
2727
|
-
var workflowProofCheckpoint = aicoderWorkflowProofCheckpointObject(app, job, evidence);
|
|
2728
|
-
var workflowProofCheckpointGate = aicoderWorkflowProofCheckpointGate(workflowProofCheckpoint, input.now);
|
|
2729
|
-
if (workflowProofCheckpointGate) {
|
|
2730
|
-
gates.push(workflowProofCheckpointGate);
|
|
2731
|
-
pushEvent(events, {
|
|
2732
|
-
type: 'log',
|
|
2733
|
-
category: 'aicoder_workflow_proof_checkpoint',
|
|
2734
|
-
message: workflowProofCheckpointGate.reason,
|
|
2735
|
-
artifactPaths: workflowProofCheckpointGate.evidenceRefs,
|
|
2736
|
-
recordedAt: workflowProofCheckpointGate.recordedAt,
|
|
2737
|
-
metadata: workflowProofCheckpointGate.metadata
|
|
2738
|
-
});
|
|
2739
|
-
}
|
|
2740
|
-
var qa = applyAICoderWorkflowProofGate(buildQaFromEvidence(evidence, input.now), workflowReadiness, input.now);
|
|
2741
|
-
return (0, ai_run_evidence_1.buildAIRun)({
|
|
2742
|
-
source: 'aicoder_app',
|
|
2743
|
-
sourceIds: sourceIds,
|
|
2744
|
-
title: firstText(app, ['name', 'title']) || firstText(job, ['appName', 'title', 'goal']),
|
|
2745
|
-
status: firstText(job, ['status', 'state']) || firstText(app, ['status', 'state']),
|
|
2746
|
-
phase: firstText(job, ['phase', 'runnerPhase']),
|
|
2747
|
-
startedAt: dateValue(job, ['startedAt', 'createdAt']) || dateValue(app, ['createdAt']),
|
|
2748
|
-
completedAt: dateValue(job, ['completedAt', 'finishedAt', 'updatedAt']),
|
|
2749
|
-
events: events,
|
|
2750
|
-
gates: gates,
|
|
2751
|
-
qa: qa,
|
|
2752
|
-
cost: cost,
|
|
2753
|
-
scorecardPassed: scorecardPassed,
|
|
2754
|
-
deployStatus: evidence.deployStatus || statusFromBoolean(evidence.deployReady),
|
|
2755
|
-
publishStatus: evidence.publishStatus || evidence.pullRequestStatus,
|
|
2756
|
-
sampleDataStatus: evidence.sampleDataStatus || statusFromBoolean((_f = evidence.sampleDataReady) !== null && _f !== void 0 ? _f : evidence.hasSampleData),
|
|
2757
|
-
manualHandoff: evidence.manualHandoff === true || job.manualHandoff === true,
|
|
2758
|
-
stopped: evidence.stopped === true || job.stopped === true,
|
|
2759
|
-
rejected: evidence.rejected === true,
|
|
2760
|
-
explicitAccepted: evidence.explicitAccepted === true || app.accepted === true,
|
|
2761
|
-
terminal: /complete|closed|resolved|done|failed|rejected/i.test("".concat(job.status || '', " ").concat(job.phase || '')),
|
|
2762
|
-
now: input.now,
|
|
2763
|
-
metadata: {
|
|
2764
|
-
domain: app.domain || app.customDomain || job.domain,
|
|
2765
|
-
wowScore: (_g = evidence.wowScore) !== null && _g !== void 0 ? _g : job.wowScore,
|
|
2766
|
-
score: (_h = evidence.score) !== null && _h !== void 0 ? _h : evidence.qualityScore,
|
|
2767
|
-
managerNoBlindLoopPolicy: managerNoBlindLoopMetadata(noBlindLoopGate),
|
|
2768
|
-
workflowProofReadiness: {
|
|
2769
|
-
ready: workflowReadiness.ready,
|
|
2770
|
-
status: workflowReadiness.status,
|
|
2771
|
-
reason: workflowReadiness.reason,
|
|
2772
|
-
blockers: workflowReadiness.blockers,
|
|
2773
|
-
primaryWorkflowId: workflowReadiness.primaryWorkflowId,
|
|
2774
|
-
passedWorkflowRows: workflowReadiness.passedWorkflowRows,
|
|
2775
|
-
missingWorkflowRows: workflowReadiness.missingWorkflowRows,
|
|
2776
|
-
failedWorkflowRows: workflowReadiness.failedWorkflowRows,
|
|
2777
|
-
sampleDataReady: workflowReadiness.sampleDataReady,
|
|
2778
|
-
releaseBlockers: workflowReadiness.releaseBlockers,
|
|
2779
|
-
workflowProofFingerprint: workflowReadiness.workflowProofFingerprint,
|
|
2780
|
-
artifactFingerprint: workflowReadiness.artifactFingerprint,
|
|
2781
|
-
proofFreshness: workflowReadiness.proofFreshness
|
|
2782
|
-
},
|
|
2783
|
-
workflowProofCheckpoint: workflowProofCheckpointGate ? {
|
|
2784
|
-
status: cleanText((_j = workflowProofCheckpointGate.metadata) === null || _j === void 0 ? void 0 : _j.status, 120),
|
|
2785
|
-
gateStatus: workflowProofCheckpointGate.status,
|
|
2786
|
-
readinessStatus: cleanText((_k = workflowProofCheckpointGate.metadata) === null || _k === void 0 ? void 0 : _k.readinessStatus, 120),
|
|
2787
|
-
nextGate: cleanText((_l = workflowProofCheckpointGate.metadata) === null || _l === void 0 ? void 0 : _l.nextGate, 120),
|
|
2788
|
-
nextAction: cleanText((_m = workflowProofCheckpointGate.metadata) === null || _m === void 0 ? void 0 : _m.nextAction, 1000),
|
|
2789
|
-
blocksProductRepairUntilJourneyContract: ((_o = workflowProofCheckpointGate.metadata) === null || _o === void 0 ? void 0 : _o.blocksProductRepairUntilJourneyContract) === true,
|
|
2790
|
-
blocksPublishUntilWorkflowProof: ((_p = workflowProofCheckpointGate.metadata) === null || _p === void 0 ? void 0 : _p.blocksPublishUntilWorkflowProof) === true,
|
|
2791
|
-
blocksPublishUntilReleaseGate: ((_q = workflowProofCheckpointGate.metadata) === null || _q === void 0 ? void 0 : _q.blocksPublishUntilReleaseGate) === true,
|
|
2792
|
-
blocksWowUiUntilWorkflowProof: ((_r = workflowProofCheckpointGate.metadata) === null || _r === void 0 ? void 0 : _r.blocksWowUiUntilWorkflowProof) === true,
|
|
2793
|
-
workflowProofFingerprint: cleanText((_s = workflowProofCheckpointGate.metadata) === null || _s === void 0 ? void 0 : _s.workflowProofFingerprint, 200),
|
|
2794
|
-
artifactFingerprint: cleanText((_t = workflowProofCheckpointGate.metadata) === null || _t === void 0 ? void 0 : _t.artifactFingerprint, 200),
|
|
2795
|
-
blockers: cleanStringList((_u = workflowProofCheckpointGate.metadata) === null || _u === void 0 ? void 0 : _u.blockers, 20, 500)
|
|
2796
|
-
} : undefined
|
|
2797
|
-
}
|
|
2798
|
-
});
|
|
2799
|
-
}
|
|
2800
|
-
function buildAssistantAIRunFromEvidence(input) {
|
|
2801
|
-
var e_31, _a, e_32, _b, e_33, _c;
|
|
2802
|
-
var _d, _e, _f, _g;
|
|
2803
|
-
var conversation = input.conversation || {};
|
|
2804
|
-
var events = [];
|
|
2805
|
-
var sourceIds = {};
|
|
2806
|
-
addSourceId(sourceIds, 'runId', input.runId);
|
|
2807
|
-
addSourceId(sourceIds, 'requestId', input.requestId);
|
|
2808
|
-
addSourceId(sourceIds, 'messageId', input.messageId);
|
|
2809
|
-
addSourceId(sourceIds, 'conversationId', conversation._id || conversation.id || conversation.conversationId);
|
|
2810
|
-
addSourceId(sourceIds, 'userId', conversation.userId || conversation.ownerId);
|
|
2811
|
-
try {
|
|
2812
|
-
for (var _h = __values(asArray(input.messages)), _j = _h.next(); !_j.done; _j = _h.next()) {
|
|
2813
|
-
var message = _j.value;
|
|
2814
|
-
pushEvent(events, {
|
|
2815
|
-
type: 'assistant_message',
|
|
2816
|
-
category: cleanText(message.role || message.authorRole || message.type, 160),
|
|
2817
|
-
message: cleanText(message.content || message.text || message.message || message.summary, 1800),
|
|
2818
|
-
recordedAt: eventDate(message),
|
|
2819
|
-
metadata: {
|
|
2820
|
-
id: message._id || message.id,
|
|
2821
|
-
role: message.role,
|
|
2822
|
-
model: message.model || ((_d = message === null || message === void 0 ? void 0 : message.usage) === null || _d === void 0 ? void 0 : _d.model)
|
|
2823
|
-
}
|
|
2824
|
-
});
|
|
2825
|
-
}
|
|
2826
|
-
}
|
|
2827
|
-
catch (e_31_1) { e_31 = { error: e_31_1 }; }
|
|
2828
|
-
finally {
|
|
2829
|
-
try {
|
|
2830
|
-
if (_j && !_j.done && (_a = _h.return)) _a.call(_h);
|
|
2831
|
-
}
|
|
2832
|
-
finally { if (e_31) throw e_31.error; }
|
|
2833
|
-
}
|
|
2834
|
-
try {
|
|
2835
|
-
for (var _k = __values(asArray(input.issueReports)), _l = _k.next(); !_l.done; _l = _k.next()) {
|
|
2836
|
-
var report = _l.value;
|
|
2837
|
-
pushEvent(events, {
|
|
2838
|
-
type: 'human_intervention',
|
|
2839
|
-
category: cleanText(report.category || report.status || 'issue_report', 160),
|
|
2840
|
-
message: cleanText(report.summary || report.description || report.message || report.title, 1800),
|
|
2841
|
-
recordedAt: eventDate(report),
|
|
2842
|
-
metadata: {
|
|
2843
|
-
id: report._id || report.id,
|
|
2844
|
-
status: report.status,
|
|
2845
|
-
severity: report.severity
|
|
2846
|
-
}
|
|
2847
|
-
});
|
|
2848
|
-
}
|
|
2849
|
-
}
|
|
2850
|
-
catch (e_32_1) { e_32 = { error: e_32_1 }; }
|
|
2851
|
-
finally {
|
|
2852
|
-
try {
|
|
2853
|
-
if (_l && !_l.done && (_b = _k.return)) _b.call(_k);
|
|
2854
|
-
}
|
|
2855
|
-
finally { if (e_32) throw e_32.error; }
|
|
2856
|
-
}
|
|
2857
|
-
var cost = collectUsageEvents(asArray(input.usageLedger), events);
|
|
2858
|
-
var answerQuality = assistantQualityObject(input);
|
|
2859
|
-
try {
|
|
2860
|
-
for (var _m = __values(assistantQueryExecutions(answerQuality).slice(0, 40)), _o = _m.next(); !_o.done; _o = _m.next()) {
|
|
2861
|
-
var execution = _o.value;
|
|
2862
|
-
var status_1 = cleanText(execution.status || execution.queryStatus || execution.query_status || execution.resultStatus || execution.result_status, 120);
|
|
2863
|
-
var toolName = cleanText(execution.tool || execution.toolName || execution.tool_name || execution.type || 'query', 160);
|
|
2864
|
-
var collection = cleanText(execution.collection || execution.collectionName || execution.collection_name, 240);
|
|
2865
|
-
pushEvent(events, {
|
|
2866
|
-
type: 'assistant_query',
|
|
2867
|
-
category: status_1 || toolName,
|
|
2868
|
-
message: cleanText(execution.summary || execution.message || "".concat(toolName).concat(collection ? " ".concat(collection) : ''), 1200),
|
|
2869
|
-
artifactPaths: cleanStringList(__spreadArray(__spreadArray([
|
|
2870
|
-
execution.artifactPath,
|
|
2871
|
-
execution.artifact_path,
|
|
2872
|
-
execution.path
|
|
2873
|
-
], __read(asArray(execution.artifactPaths)), false), __read(asArray(execution.artifact_paths)), false), 20, 500),
|
|
2874
|
-
recordedAt: eventDate(execution),
|
|
2875
|
-
metadata: {
|
|
2876
|
-
id: execution.id || execution._id || execution.ref,
|
|
2877
|
-
tool: toolName,
|
|
2878
|
-
status: status_1,
|
|
2879
|
-
collection: collection,
|
|
2880
|
-
resultCount: (_f = (_e = execution.resultCount) !== null && _e !== void 0 ? _e : execution.result_count) !== null && _f !== void 0 ? _f : execution.count,
|
|
2881
|
-
queryStatus: execution.queryStatus || execution.query_status,
|
|
2882
|
-
legalQueryShape: (_g = execution.legalQueryShape) !== null && _g !== void 0 ? _g : execution.legal_query_shape
|
|
2883
|
-
}
|
|
2884
|
-
});
|
|
2885
|
-
}
|
|
2886
|
-
}
|
|
2887
|
-
catch (e_33_1) { e_33 = { error: e_33_1 }; }
|
|
2888
|
-
finally {
|
|
2889
|
-
try {
|
|
2890
|
-
if (_o && !_o.done && (_c = _m.return)) _c.call(_m);
|
|
2891
|
-
}
|
|
2892
|
-
finally { if (e_33) throw e_33.error; }
|
|
2893
|
-
}
|
|
2894
|
-
var answerQualityDecision = evaluateAssistantAnswerQuality({
|
|
2895
|
-
answerQuality: answerQuality,
|
|
2896
|
-
correctnessChecks: input.correctnessChecks,
|
|
2897
|
-
now: input.now
|
|
2898
|
-
});
|
|
2899
|
-
var answerQualityGate = assistantAnswerQualityGate(answerQualityDecision, input.now);
|
|
2900
|
-
pushEvent(events, {
|
|
2901
|
-
type: 'assistant_message',
|
|
2902
|
-
category: 'assistant_answer_quality',
|
|
2903
|
-
message: answerQualityGate.reason,
|
|
2904
|
-
artifactPaths: answerQualityGate.evidenceRefs,
|
|
2905
|
-
recordedAt: answerQualityGate.recordedAt,
|
|
2906
|
-
metadata: answerQualityGate.metadata
|
|
2907
|
-
});
|
|
2908
|
-
var correctnessChecks = asArray(input.correctnessChecks);
|
|
2909
|
-
var hasPassedCorrectnessCheck = correctnessChecks.some(function (check) { return /^(pass|passed|success|ok)$/i.test(cleanText(check.status || (check.passed === true ? 'pass' : ''), 80)); });
|
|
2910
|
-
var correctnessEvidence = {
|
|
2911
|
-
businessAssertions: __spreadArray(__spreadArray([], __read(correctnessChecks.map(function (check) { return ({
|
|
2912
|
-
assertion: check.assertion || check.name || check.case || 'assistant correctness check',
|
|
2913
|
-
status: check.status || statusFromBoolean(check.passed),
|
|
2914
|
-
expected: check.expected,
|
|
2915
|
-
observed: check.observed || check.actual,
|
|
2916
|
-
dataProof: check.dataProof || check.proof,
|
|
2917
|
-
artifactPaths: check.artifactPaths,
|
|
2918
|
-
message: check.message || check.reason,
|
|
2919
|
-
metadata: check.metadata,
|
|
2920
|
-
recordedAt: eventDate(check)
|
|
2921
|
-
}); })), false), __read((answerQualityDecision.ready && !hasPassedCorrectnessCheck ? [{
|
|
2922
|
-
assertion: 'Assistant answer quality gate passed.',
|
|
2923
|
-
status: 'pass',
|
|
2924
|
-
expected: 'Correct dates, legal query shape, query result classification, cited evidence, confidence, and next action.',
|
|
2925
|
-
observed: answerQualityDecision.reason,
|
|
2926
|
-
dataProof: answerQualityDecision.evidenceRefs.concat(answerQualityDecision.citationRefs).join(', '),
|
|
2927
|
-
artifactPaths: answerQualityDecision.evidenceRefs,
|
|
2928
|
-
message: answerQualityDecision.reason,
|
|
2929
|
-
metadata: {
|
|
2930
|
-
answerQualityStatus: answerQualityDecision.status,
|
|
2931
|
-
queryStatus: answerQualityDecision.queryStatus,
|
|
2932
|
-
dateWindowRequired: answerQualityDecision.dateWindowRequired,
|
|
2933
|
-
dateWindowPresent: answerQualityDecision.dateWindowPresent,
|
|
2934
|
-
dateWindow: answerQualityDecision.dateWindow
|
|
2935
|
-
}
|
|
2936
|
-
}] : [])), false)
|
|
2937
|
-
};
|
|
2938
|
-
var qa = applyAssistantAnswerQualityGate(buildQaFromEvidence(correctnessEvidence, input.now), answerQualityDecision, input.now);
|
|
2939
|
-
var failedReports = asArray(input.issueReports)
|
|
2940
|
-
.filter(function (report) { return /open|new|fail|bug|wrong|incorrect|error/i.test("".concat(report.status || '', " ").concat(report.category || '', " ").concat(report.summary || '')); });
|
|
2941
|
-
return (0, ai_run_evidence_1.buildAIRun)({
|
|
2942
|
-
id: cleanText(input.runId, 240) || undefined,
|
|
2943
|
-
source: 'ai_assistant',
|
|
2944
|
-
sourceIds: sourceIds,
|
|
2945
|
-
title: firstText(conversation, ['title', 'subject', 'summary']) || 'AI assistant conversation',
|
|
2946
|
-
status: firstText(conversation, ['status', 'state']),
|
|
2947
|
-
phase: firstText(conversation, ['phase']),
|
|
2948
|
-
startedAt: dateValue(conversation, ['startedAt', 'createdAt']),
|
|
2949
|
-
completedAt: dateValue(conversation, ['completedAt', 'closedAt', 'updatedAt']),
|
|
2950
|
-
events: events,
|
|
2951
|
-
qa: qa,
|
|
2952
|
-
cost: cost,
|
|
2953
|
-
rejected: failedReports.length > 0 || conversation.rejected === true,
|
|
2954
|
-
manualHandoff: conversation.manualHandoff === true,
|
|
2955
|
-
stopped: conversation.stopped === true,
|
|
2956
|
-
explicitAccepted: conversation.accepted === true,
|
|
2957
|
-
terminal: /complete|closed|resolved|done|failed|rejected/i.test("".concat(conversation.status || '')),
|
|
2958
|
-
now: input.now,
|
|
2959
|
-
metadata: {
|
|
2960
|
-
issueReportCount: asArray(input.issueReports).length,
|
|
2961
|
-
correctnessCheckCount: correctnessChecks.length,
|
|
2962
|
-
answerQuality: {
|
|
2963
|
-
ready: answerQualityDecision.ready,
|
|
2964
|
-
status: answerQualityDecision.status,
|
|
2965
|
-
queryStatus: answerQualityDecision.queryStatus,
|
|
2966
|
-
confidenceLevel: answerQualityDecision.confidenceLevel,
|
|
2967
|
-
dateBasis: answerQualityDecision.dateBasis,
|
|
2968
|
-
expectedCurrentDate: answerQualityDecision.expectedCurrentDate,
|
|
2969
|
-
dateWindowRequired: answerQualityDecision.dateWindowRequired,
|
|
2970
|
-
dateWindowPresent: answerQualityDecision.dateWindowPresent,
|
|
2971
|
-
dateWindow: answerQualityDecision.dateWindow,
|
|
2972
|
-
noDataConfirmed: answerQualityDecision.noDataConfirmed,
|
|
2973
|
-
legalQueryShape: answerQualityDecision.legalQueryShape,
|
|
2974
|
-
citationRefs: answerQualityDecision.citationRefs,
|
|
2975
|
-
queryEvidenceRequired: answerQualityDecision.queryEvidenceRequired,
|
|
2976
|
-
queryEvidencePresent: answerQualityDecision.queryEvidencePresent,
|
|
2977
|
-
queryEvidenceRefs: answerQualityDecision.queryEvidenceRefs,
|
|
2978
|
-
queryExecutionCount: answerQualityDecision.queryExecutionCount,
|
|
2979
|
-
nextActions: answerQualityDecision.nextActions,
|
|
2980
|
-
blockers: answerQualityDecision.blockers
|
|
2981
|
-
}
|
|
2982
|
-
}
|
|
2983
|
-
});
|
|
2984
|
-
}
|
|
2985
|
-
|
|
2986
|
-
//# sourceMappingURL=ai-run-evidence-adapters.js.map
|