@resolveio/server-lib 22.3.175 → 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 -3087
- 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 -867
- 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 -792
- 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,3497 +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.selectResolveIOSupportSimilarCaseHints = selectResolveIOSupportSimilarCaseHints;
|
|
51
|
-
exports.buildResolveIOSupportDiagnosisEvidencePack = buildResolveIOSupportDiagnosisEvidencePack;
|
|
52
|
-
exports.evaluateResolveIOSupportDiagnosisEvidenceQuality = evaluateResolveIOSupportDiagnosisEvidenceQuality;
|
|
53
|
-
exports.normalizeResolveIOSupportDiagnosisGate = normalizeResolveIOSupportDiagnosisGate;
|
|
54
|
-
exports.extractResolveIOSupportDiagnosisGateFromText = extractResolveIOSupportDiagnosisGateFromText;
|
|
55
|
-
exports.validateResolveIOSupportDiagnosisGate = validateResolveIOSupportDiagnosisGate;
|
|
56
|
-
exports.evaluateResolveIOSupportBusinessProofReadiness = evaluateResolveIOSupportBusinessProofReadiness;
|
|
57
|
-
exports.decideResolveIOSupportCustomerReplyPolicy = decideResolveIOSupportCustomerReplyPolicy;
|
|
58
|
-
exports.buildResolveIOSupportIssueClassProbes = buildResolveIOSupportIssueClassProbes;
|
|
59
|
-
exports.hashResolveIOSupportV5Evidence = hashResolveIOSupportV5Evidence;
|
|
60
|
-
exports.decideResolveIOSupportV5RepeatedFailureStop = decideResolveIOSupportV5RepeatedFailureStop;
|
|
61
|
-
exports.evaluateResolveIOSupportEvidenceFreshness = evaluateResolveIOSupportEvidenceFreshness;
|
|
62
|
-
exports.buildResolveIOSupportContinuationProofCheckpoint = buildResolveIOSupportContinuationProofCheckpoint;
|
|
63
|
-
exports.changedFilesOutsideResolveIOSupportDiagnosisOwnerFiles = changedFilesOutsideResolveIOSupportDiagnosisOwnerFiles;
|
|
64
|
-
exports.decideResolveIOSupportV5RepairGate = decideResolveIOSupportV5RepairGate;
|
|
65
|
-
exports.applyResolveIOSupportDiagnosisGateToMicrotasks = applyResolveIOSupportDiagnosisGateToMicrotasks;
|
|
66
|
-
exports.fingerprintResolveIOSupportV5Blocker = fingerprintResolveIOSupportV5Blocker;
|
|
67
|
-
exports.buildResolveIOSupportV5Budget = buildResolveIOSupportV5Budget;
|
|
68
|
-
exports.buildResolveIOSupportV5PromptBudget = buildResolveIOSupportV5PromptBudget;
|
|
69
|
-
exports.buildResolveIOSupportV5ScopeDigest = buildResolveIOSupportV5ScopeDigest;
|
|
70
|
-
exports.buildResolveIOSupportV5MicrotaskLedger = buildResolveIOSupportV5MicrotaskLedger;
|
|
71
|
-
exports.selectResolveIOSupportV5ActiveMicrotask = selectResolveIOSupportV5ActiveMicrotask;
|
|
72
|
-
exports.initializeResolveIOSupportV5State = initializeResolveIOSupportV5State;
|
|
73
|
-
exports.recordResolveIOSupportV5Step = recordResolveIOSupportV5Step;
|
|
74
|
-
exports.recordResolveIOSupportV5MicrotaskUsage = recordResolveIOSupportV5MicrotaskUsage;
|
|
75
|
-
exports.decideResolveIOSupportV5Continuation = decideResolveIOSupportV5Continuation;
|
|
76
|
-
exports.decideResolveIOSupportV5AutonomousNextAction = decideResolveIOSupportV5AutonomousNextAction;
|
|
77
|
-
exports.buildResolveIOSupportV5DiagnoseFirstPrompt = buildResolveIOSupportV5DiagnoseFirstPrompt;
|
|
78
|
-
exports.buildResolveIOSupportV5MicrotaskPrompt = buildResolveIOSupportV5MicrotaskPrompt;
|
|
79
|
-
exports.summarizeResolveIOSupportV5MicrotaskUsage = summarizeResolveIOSupportV5MicrotaskUsage;
|
|
80
|
-
exports.buildResolveIOSupportV5Incident = buildResolveIOSupportV5Incident;
|
|
81
|
-
var ai_runner_manager_policy_1 = require("./ai-runner-manager-policy");
|
|
82
|
-
function isoNow(value) {
|
|
83
|
-
if (value instanceof Date) {
|
|
84
|
-
return value.toISOString();
|
|
85
|
-
}
|
|
86
|
-
var parsed = value ? new Date(value) : new Date();
|
|
87
|
-
if (Number.isFinite(parsed.getTime())) {
|
|
88
|
-
return parsed.toISOString();
|
|
89
|
-
}
|
|
90
|
-
return new Date().toISOString();
|
|
91
|
-
}
|
|
92
|
-
function cleanText(value, max) {
|
|
93
|
-
if (max === void 0) { max = 2000; }
|
|
94
|
-
return String(value || '').replace(/\s+/g, ' ').trim().slice(0, max);
|
|
95
|
-
}
|
|
96
|
-
function cleanList(values, limit, max) {
|
|
97
|
-
var e_1, _a;
|
|
98
|
-
if (limit === void 0) { limit = 20; }
|
|
99
|
-
if (max === void 0) { max = 500; }
|
|
100
|
-
if (!Array.isArray(values)) {
|
|
101
|
-
return [];
|
|
102
|
-
}
|
|
103
|
-
var result = [];
|
|
104
|
-
try {
|
|
105
|
-
for (var values_1 = __values(values), values_1_1 = values_1.next(); !values_1_1.done; values_1_1 = values_1.next()) {
|
|
106
|
-
var value = values_1_1.value;
|
|
107
|
-
var normalized = cleanText(value, max);
|
|
108
|
-
if (normalized && !result.includes(normalized)) {
|
|
109
|
-
result.push(normalized);
|
|
110
|
-
}
|
|
111
|
-
if (result.length >= limit) {
|
|
112
|
-
break;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
117
|
-
finally {
|
|
118
|
-
try {
|
|
119
|
-
if (values_1_1 && !values_1_1.done && (_a = values_1.return)) _a.call(values_1);
|
|
120
|
-
}
|
|
121
|
-
finally { if (e_1) throw e_1.error; }
|
|
122
|
-
}
|
|
123
|
-
return result;
|
|
124
|
-
}
|
|
125
|
-
function cleanObject(value) {
|
|
126
|
-
return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
127
|
-
}
|
|
128
|
-
function pickText(source, fields, max) {
|
|
129
|
-
var e_2, _a;
|
|
130
|
-
if (max === void 0) { max = 1000; }
|
|
131
|
-
try {
|
|
132
|
-
for (var fields_1 = __values(fields), fields_1_1 = fields_1.next(); !fields_1_1.done; fields_1_1 = fields_1.next()) {
|
|
133
|
-
var field = fields_1_1.value;
|
|
134
|
-
var normalized = cleanText(source === null || source === void 0 ? void 0 : source[field], max);
|
|
135
|
-
if (normalized) {
|
|
136
|
-
return normalized;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
141
|
-
finally {
|
|
142
|
-
try {
|
|
143
|
-
if (fields_1_1 && !fields_1_1.done && (_a = fields_1.return)) _a.call(fields_1);
|
|
144
|
-
}
|
|
145
|
-
finally { if (e_2) throw e_2.error; }
|
|
146
|
-
}
|
|
147
|
-
return '';
|
|
148
|
-
}
|
|
149
|
-
function normalizeIssueClass(value) {
|
|
150
|
-
var normalized = cleanText(value, 80)
|
|
151
|
-
.toLowerCase()
|
|
152
|
-
.replace(/[\s-]+/g, '_');
|
|
153
|
-
var aliases = {
|
|
154
|
-
no_op: 'no_op_submit',
|
|
155
|
-
no_op_submit: 'no_op_submit',
|
|
156
|
-
submit_noop: 'no_op_submit',
|
|
157
|
-
missing_data: 'missing_wrong_data',
|
|
158
|
-
wrong_data: 'missing_wrong_data',
|
|
159
|
-
missing_wrong_data: 'missing_wrong_data',
|
|
160
|
-
filter_mismatch: 'filter_query_mismatch',
|
|
161
|
-
query_mismatch: 'filter_query_mismatch',
|
|
162
|
-
filter_query_mismatch: 'filter_query_mismatch',
|
|
163
|
-
invoice_pdf_export: 'invoice_pdf_export',
|
|
164
|
-
pdf_export: 'invoice_pdf_export',
|
|
165
|
-
export: 'invoice_pdf_export',
|
|
166
|
-
upload: 'upload_import',
|
|
167
|
-
import: 'upload_import',
|
|
168
|
-
upload_import: 'upload_import',
|
|
169
|
-
route_auth: 'route_auth_hydration',
|
|
170
|
-
auth_hydration: 'route_auth_hydration',
|
|
171
|
-
route_auth_hydration: 'route_auth_hydration',
|
|
172
|
-
slow_query: 'slow_query_performance',
|
|
173
|
-
performance: 'slow_query_performance',
|
|
174
|
-
slow_query_performance: 'slow_query_performance'
|
|
175
|
-
};
|
|
176
|
-
return aliases[normalized] || '';
|
|
177
|
-
}
|
|
178
|
-
function normalizeReproductionStatus(value) {
|
|
179
|
-
var normalized = cleanText(value, 80).toLowerCase();
|
|
180
|
-
if (/blocked|unable|cannot/.test(normalized)) {
|
|
181
|
-
return 'blocked';
|
|
182
|
-
}
|
|
183
|
-
if (/classif|triag|inferred/.test(normalized)) {
|
|
184
|
-
return 'classified';
|
|
185
|
-
}
|
|
186
|
-
return 'reproduced';
|
|
187
|
-
}
|
|
188
|
-
function normalizeSupportDiagnosisEvidence(values) {
|
|
189
|
-
var allowed = new Set(['ticket', 'browser', 'mongo', 'log', 'code', 'commit', 'qa', 'other']);
|
|
190
|
-
if (!Array.isArray(values)) {
|
|
191
|
-
var summary = cleanText(values, 1200);
|
|
192
|
-
return summary ? [{ type: 'other', summary: summary }] : [];
|
|
193
|
-
}
|
|
194
|
-
var stringEvidence = values
|
|
195
|
-
.filter(function (entry) { return typeof entry === 'string'; })
|
|
196
|
-
.map(function (entry) { return ({
|
|
197
|
-
type: 'other',
|
|
198
|
-
summary: cleanText(entry, 1200)
|
|
199
|
-
}); });
|
|
200
|
-
var objectEvidence = values
|
|
201
|
-
.filter(function (entry) { return entry && typeof entry === 'object' && !Array.isArray(entry); })
|
|
202
|
-
.map(function (entry) {
|
|
203
|
-
var type = cleanText(entry.type, 80).toLowerCase();
|
|
204
|
-
return {
|
|
205
|
-
type: (allowed.has(type) ? type : 'other'),
|
|
206
|
-
summary: cleanText(entry.summary || entry.message || entry.evidence || entry.reason, 1200),
|
|
207
|
-
artifactPath: cleanText(entry.artifactPath || entry.path || entry.file, 500)
|
|
208
|
-
};
|
|
209
|
-
});
|
|
210
|
-
return stringEvidence.concat(objectEvidence)
|
|
211
|
-
.filter(function (entry) { return entry.summary; })
|
|
212
|
-
.slice(0, 20);
|
|
213
|
-
}
|
|
214
|
-
function normalizeSupportDiagnosisHints(values) {
|
|
215
|
-
return (Array.isArray(values) ? values : [])
|
|
216
|
-
.map(function (entry) {
|
|
217
|
-
if (typeof entry === 'string') {
|
|
218
|
-
return { reason: cleanText(entry, 500) };
|
|
219
|
-
}
|
|
220
|
-
var value = cleanObject(entry);
|
|
221
|
-
return {
|
|
222
|
-
id: cleanText(value.id || value._id, 160),
|
|
223
|
-
ticketNumber: cleanText(value.ticketNumber || value.ticket_number || value.sourceTicketNumber, 80),
|
|
224
|
-
title: cleanText(value.title || value.summary, 300),
|
|
225
|
-
outcome: cleanText(value.outcome || value.status, 80),
|
|
226
|
-
issueClass: cleanText(value.issueClass || value.issue_class, 80),
|
|
227
|
-
ownerFiles: cleanList(value.ownerFiles || value.owner_files || value.files, 8, 240),
|
|
228
|
-
commitSha: cleanText(value.commitSha || value.commit_sha, 80),
|
|
229
|
-
commitMessage: cleanText(value.commitMessage || value.commit_message, 300),
|
|
230
|
-
reason: cleanText(value.reason || value.matchReason || value.match_reason, 500)
|
|
231
|
-
};
|
|
232
|
-
})
|
|
233
|
-
.filter(function (entry) { return entry.id || entry.ticketNumber || entry.title || entry.reason || entry.commitSha; })
|
|
234
|
-
.slice(0, 8);
|
|
235
|
-
}
|
|
236
|
-
function normalizeSupportSimilarCaseSource(value) {
|
|
237
|
-
var normalized = cleanText(value, 80).toLowerCase();
|
|
238
|
-
if (/commit|git/.test(normalized)) {
|
|
239
|
-
return 'git_commit';
|
|
240
|
-
}
|
|
241
|
-
if (/ticket/.test(normalized)) {
|
|
242
|
-
return 'support_ticket';
|
|
243
|
-
}
|
|
244
|
-
if (/airun|ai_run|run/.test(normalized)) {
|
|
245
|
-
return 'airun';
|
|
246
|
-
}
|
|
247
|
-
return 'manual';
|
|
248
|
-
}
|
|
249
|
-
function supportOutcomeLooksAccepted(value) {
|
|
250
|
-
return /^(accepted|pass|passed|complete|completed|merged|released)$/i.test(cleanText(value, 80));
|
|
251
|
-
}
|
|
252
|
-
function supportOutcomeLooksRejected(value) {
|
|
253
|
-
return /\b(reject|rejected|false_pass|failed|failure|blocked|unknown|stopped|manual_handoff)\b/i.test(cleanText(value, 120));
|
|
254
|
-
}
|
|
255
|
-
function supportOwnerFileDirectory(value) {
|
|
256
|
-
var normalized = normalizeOwnerFilePath(value);
|
|
257
|
-
var parts = normalized.split('/').filter(Boolean);
|
|
258
|
-
return parts.length > 1 ? parts.slice(0, -1).join('/') : normalized;
|
|
259
|
-
}
|
|
260
|
-
function supportTextTokens(value) {
|
|
261
|
-
var stop = new Set(['the', 'and', 'for', 'with', 'that', 'this', 'from', 'into', 'when', 'where', 'what', 'have', 'has', 'had', 'not', 'but', 'are', 'was', 'were', 'issue', 'ticket', 'support']);
|
|
262
|
-
return Array.from(new Set(cleanText(value, 3000).toLowerCase()
|
|
263
|
-
.split(/[^a-z0-9_/-]+/g)
|
|
264
|
-
.map(function (token) { return token.trim(); })
|
|
265
|
-
.filter(function (token) { return token.length >= 3 && !stop.has(token); })))
|
|
266
|
-
.slice(0, 80);
|
|
267
|
-
}
|
|
268
|
-
function normalizeResolveIOSupportSimilarCaseCandidate(value) {
|
|
269
|
-
var _a, _b;
|
|
270
|
-
var source = cleanObject(value);
|
|
271
|
-
if (!Object.keys(source).length && typeof value !== 'string') {
|
|
272
|
-
return undefined;
|
|
273
|
-
}
|
|
274
|
-
if (typeof value === 'string') {
|
|
275
|
-
var summary = cleanText(value, 500);
|
|
276
|
-
return summary ? {
|
|
277
|
-
source: 'manual',
|
|
278
|
-
title: summary,
|
|
279
|
-
summary: summary,
|
|
280
|
-
keywords: supportTextTokens(summary)
|
|
281
|
-
} : undefined;
|
|
282
|
-
}
|
|
283
|
-
var metadata = cleanObject(source.metadata);
|
|
284
|
-
var runSourceIds = cleanObject(source.sourceIds || source.source_ids || metadata.sourceIds || metadata.source_ids);
|
|
285
|
-
var diagnosis = cleanObject(source.diagnosisGate || source.diagnosis_gate || source.supportV5DiagnosisGate || source.support_v5_diagnosis_gate || metadata.diagnosisGate || metadata.diagnosis_gate);
|
|
286
|
-
var sourceIds = cleanObject(source.sourceIds || source.source_ids || metadata.sourceIds || metadata.source_ids);
|
|
287
|
-
var sourceText = [
|
|
288
|
-
source.title,
|
|
289
|
-
source.summary,
|
|
290
|
-
source.message,
|
|
291
|
-
source.description,
|
|
292
|
-
source.reason,
|
|
293
|
-
source.commitMessage,
|
|
294
|
-
source.commit_message,
|
|
295
|
-
(_a = diagnosis.issue_case) === null || _a === void 0 ? void 0 : _a.customer_complaint,
|
|
296
|
-
(_b = diagnosis.accepted_hypothesis) === null || _b === void 0 ? void 0 : _b.statement
|
|
297
|
-
].filter(Boolean).join(' ');
|
|
298
|
-
var ownerFiles = cleanList(source.ownerFiles
|
|
299
|
-
|| source.owner_files
|
|
300
|
-
|| source.files
|
|
301
|
-
|| diagnosis.owner_files
|
|
302
|
-
|| diagnosis.ownerFiles
|
|
303
|
-
|| metadata.ownerFiles
|
|
304
|
-
|| metadata.owner_files, 12, 300).map(normalizeOwnerFilePath).filter(Boolean);
|
|
305
|
-
var issueClass = cleanText(source.issueClass
|
|
306
|
-
|| source.issue_class
|
|
307
|
-
|| diagnosis.issue_class
|
|
308
|
-
|| diagnosis.issueClass
|
|
309
|
-
|| metadata.issueClass
|
|
310
|
-
|| metadata.issue_class, 80);
|
|
311
|
-
var candidate = {
|
|
312
|
-
source: normalizeSupportSimilarCaseSource(source.source || source.type || source.runSource),
|
|
313
|
-
id: cleanText(source.id || source._id || source.runId || source.run_id, 160),
|
|
314
|
-
ticketNumber: cleanText(source.ticketNumber || source.ticket_number || source.sourceTicketNumber || sourceIds.ticketNumber || runSourceIds.ticketNumber, 80),
|
|
315
|
-
title: cleanText(source.title || source.name || source.summary, 300),
|
|
316
|
-
outcome: cleanText(source.outcome || source.status || source.outcomeLabel || source.outcome_label, 80),
|
|
317
|
-
issueClass: normalizeIssueClass(issueClass) || cleanText(issueClass, 80),
|
|
318
|
-
ownerFiles: ownerFiles,
|
|
319
|
-
commitSha: cleanText(source.commitSha || source.commit_sha || source.sha || source.sourceCommitSha || source.source_commit_sha, 80),
|
|
320
|
-
commitMessage: cleanText(source.commitMessage || source.commit_message || source.message, 300),
|
|
321
|
-
reason: cleanText(source.reason || source.matchReason || source.match_reason, 500),
|
|
322
|
-
summary: cleanText(source.summary || source.description || source.message || sourceText, 800),
|
|
323
|
-
keywords: cleanList(source.keywords || source.tags, 20, 80).concat(supportTextTokens(sourceText)).slice(0, 40),
|
|
324
|
-
updatedAt: isoNow(source.updatedAt || source.updated_at || source.recordedAt || source.recorded_at || source.createdAt || source.created_at),
|
|
325
|
-
metadata: metadata
|
|
326
|
-
};
|
|
327
|
-
if (!candidate.id && !candidate.ticketNumber && !candidate.title && !candidate.commitSha && !candidate.summary) {
|
|
328
|
-
return undefined;
|
|
329
|
-
}
|
|
330
|
-
if (candidate.commitSha && candidate.source === 'manual') {
|
|
331
|
-
candidate.source = 'git_commit';
|
|
332
|
-
}
|
|
333
|
-
if (candidate.ticketNumber && candidate.source === 'manual') {
|
|
334
|
-
candidate.source = 'support_ticket';
|
|
335
|
-
}
|
|
336
|
-
return candidate;
|
|
337
|
-
}
|
|
338
|
-
function selectResolveIOSupportSimilarCaseHints(input) {
|
|
339
|
-
var e_3, _a;
|
|
340
|
-
if (input === void 0) { input = {}; }
|
|
341
|
-
var issueClass = normalizeIssueClass(input.issueClass);
|
|
342
|
-
var ownerFiles = cleanList(input.ownerFiles, 12, 300).map(normalizeOwnerFilePath).filter(Boolean);
|
|
343
|
-
var ownerFileSet = new Set(ownerFiles);
|
|
344
|
-
var ownerDirs = new Set(ownerFiles.map(supportOwnerFileDirectory).filter(Boolean));
|
|
345
|
-
var textTokens = new Set(supportTextTokens(input.text));
|
|
346
|
-
var limit = Math.max(1, Math.min(12, Number(input.limit || 6)));
|
|
347
|
-
var normalized = (Array.isArray(input.candidates) ? input.candidates : [])
|
|
348
|
-
.map(normalizeResolveIOSupportSimilarCaseCandidate)
|
|
349
|
-
.filter(function (candidate) { return !!candidate; });
|
|
350
|
-
var ranked = [];
|
|
351
|
-
var ignoredCount = 0;
|
|
352
|
-
try {
|
|
353
|
-
for (var normalized_1 = __values(normalized), normalized_1_1 = normalized_1.next(); !normalized_1_1.done; normalized_1_1 = normalized_1.next()) {
|
|
354
|
-
var candidate = normalized_1_1.value;
|
|
355
|
-
var outcomeKnown = !!candidate.outcome;
|
|
356
|
-
var accepted = supportOutcomeLooksAccepted(candidate.outcome) || (!!candidate.commitSha && !supportOutcomeLooksRejected(candidate.outcome));
|
|
357
|
-
if (outcomeKnown && !accepted) {
|
|
358
|
-
ignoredCount += 1;
|
|
359
|
-
continue;
|
|
360
|
-
}
|
|
361
|
-
var signals = [];
|
|
362
|
-
var score = accepted ? 100 : 40;
|
|
363
|
-
var candidateIssueClass = normalizeIssueClass(candidate.issueClass);
|
|
364
|
-
if (issueClass && candidateIssueClass && issueClass === candidateIssueClass) {
|
|
365
|
-
score += 45;
|
|
366
|
-
signals.push("issue_class:".concat(issueClass));
|
|
367
|
-
}
|
|
368
|
-
var exactOwnerOverlap = candidate.ownerFiles.filter(function (file) { return ownerFileSet.has(normalizeOwnerFilePath(file)); });
|
|
369
|
-
if (exactOwnerOverlap.length) {
|
|
370
|
-
score += 35 + Math.min(20, exactOwnerOverlap.length * 5);
|
|
371
|
-
signals.push("owner_file_overlap:".concat(exactOwnerOverlap.slice(0, 3).join(',')));
|
|
372
|
-
}
|
|
373
|
-
var directoryOverlap = candidate.ownerFiles
|
|
374
|
-
.map(supportOwnerFileDirectory)
|
|
375
|
-
.filter(function (dir) { return dir && ownerDirs.has(dir); });
|
|
376
|
-
if (directoryOverlap.length && !exactOwnerOverlap.length) {
|
|
377
|
-
score += 18;
|
|
378
|
-
signals.push("owner_dir_overlap:".concat(Array.from(new Set(directoryOverlap)).slice(0, 2).join(',')));
|
|
379
|
-
}
|
|
380
|
-
var candidateTokens = new Set(__spreadArray(__spreadArray([], __read((candidate.keywords || [])), false), __read(supportTextTokens([candidate.title, candidate.summary, candidate.commitMessage].join(' '))), false));
|
|
381
|
-
var tokenOverlap = Array.from(candidateTokens).filter(function (token) { return textTokens.has(token); }).slice(0, 6);
|
|
382
|
-
if (tokenOverlap.length) {
|
|
383
|
-
score += Math.min(18, tokenOverlap.length * 3);
|
|
384
|
-
signals.push("weak_text_overlap:".concat(tokenOverlap.join(',')));
|
|
385
|
-
}
|
|
386
|
-
if (candidate.commitSha) {
|
|
387
|
-
score += 8;
|
|
388
|
-
signals.push('commit_linked');
|
|
389
|
-
}
|
|
390
|
-
if (!signals.length && score < 100) {
|
|
391
|
-
ignoredCount += 1;
|
|
392
|
-
continue;
|
|
393
|
-
}
|
|
394
|
-
ranked.push({
|
|
395
|
-
id: candidate.id,
|
|
396
|
-
ticketNumber: candidate.ticketNumber,
|
|
397
|
-
title: candidate.title,
|
|
398
|
-
outcome: candidate.outcome || (candidate.commitSha ? 'commit_hint' : ''),
|
|
399
|
-
issueClass: candidateIssueClass || candidate.issueClass,
|
|
400
|
-
ownerFiles: candidate.ownerFiles.slice(0, 8),
|
|
401
|
-
commitSha: candidate.commitSha,
|
|
402
|
-
commitMessage: candidate.commitMessage,
|
|
403
|
-
reason: signals.join('; '),
|
|
404
|
-
source: candidate.source,
|
|
405
|
-
score: score,
|
|
406
|
-
structuredSignals: signals,
|
|
407
|
-
advisoryOnly: true
|
|
408
|
-
});
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
412
|
-
finally {
|
|
413
|
-
try {
|
|
414
|
-
if (normalized_1_1 && !normalized_1_1.done && (_a = normalized_1.return)) _a.call(normalized_1);
|
|
415
|
-
}
|
|
416
|
-
finally { if (e_3) throw e_3.error; }
|
|
417
|
-
}
|
|
418
|
-
var sorted = ranked
|
|
419
|
-
.sort(function (a, b) { return b.score - a.score || String(b.ticketNumber || b.commitSha || '').localeCompare(String(a.ticketNumber || a.commitSha || '')); })
|
|
420
|
-
.slice(0, limit);
|
|
421
|
-
return {
|
|
422
|
-
ranked: sorted,
|
|
423
|
-
similarTickets: sorted.filter(function (hint) { return hint.source !== 'git_commit'; }).slice(0, limit),
|
|
424
|
-
similarCommits: sorted.filter(function (hint) { return hint.source === 'git_commit' || !!hint.commitSha; }).slice(0, limit),
|
|
425
|
-
ignoredCount: ignoredCount,
|
|
426
|
-
generatedAt: isoNow(input.now)
|
|
427
|
-
};
|
|
428
|
-
}
|
|
429
|
-
var SUPPORT_DIAGNOSIS_GATE_REQUIRED_FIELDS = [
|
|
430
|
-
'issue_case',
|
|
431
|
-
'issue_class',
|
|
432
|
-
'accepted_hypothesis',
|
|
433
|
-
'rejected_alternatives',
|
|
434
|
-
'failing_path',
|
|
435
|
-
'owner_files',
|
|
436
|
-
'proof_plan',
|
|
437
|
-
'evidence',
|
|
438
|
-
'status'
|
|
439
|
-
];
|
|
440
|
-
var SUPPORT_DIAGNOSIS_REQUIRED_EVIDENCE = [
|
|
441
|
-
'customer complaint, expected result, observed result, route/module, and account/customer context',
|
|
442
|
-
'reproduction proof or blocked-reproduction reason',
|
|
443
|
-
'one accepted falsifiable root-cause hypothesis with evidence',
|
|
444
|
-
'rejected alternatives showing the runner did not guess',
|
|
445
|
-
'frontend/backend/shared failing path',
|
|
446
|
-
'small exact owner_files set',
|
|
447
|
-
'before/action/after business proof plan',
|
|
448
|
-
'AIQaBusinessAssertion acceptance requirement'
|
|
449
|
-
];
|
|
450
|
-
var SUPPORT_DIAGNOSIS_FORBIDDEN_ACTIONS = [
|
|
451
|
-
'Do not edit source, package, generated, fixture, QA artifact, or local data files while building the diagnosis gate.',
|
|
452
|
-
'Do not use similar tickets or commits as proof; they are advisory hints only.',
|
|
453
|
-
'Do not broaden owner_files from similar hints without fresh evidence from the current ticket.',
|
|
454
|
-
'Do not accept route load, screenshot, scorecard, wow score, or model claim as ticket acceptance.',
|
|
455
|
-
'Do not run product-code repair until SupportDiagnosisGate validates.'
|
|
456
|
-
];
|
|
457
|
-
var SUPPORT_ISSUE_CLASS_PROBE_CATALOG = [{
|
|
458
|
-
issue_class: 'no_op_submit',
|
|
459
|
-
probe_type: 'issue_class_probe',
|
|
460
|
-
failure_class: 'business',
|
|
461
|
-
action: 'Submit the reported form/action and prove a persisted state change or expected validation result.',
|
|
462
|
-
proof_required: 'Before/action/after DOM or data proof that the submit is no longer a no-op.',
|
|
463
|
-
required_artifacts: ['before form state', 'submit action trace', 'post-submit DOM/data proof', 'method or network result'],
|
|
464
|
-
acceptance_gate: 'aiqa_business_assertion',
|
|
465
|
-
false_pass_blockers: ['route loaded only', 'button clicked without persisted result', 'model claim without DOM/data proof']
|
|
466
|
-
}, {
|
|
467
|
-
issue_class: 'missing_wrong_data',
|
|
468
|
-
probe_type: 'issue_class_probe',
|
|
469
|
-
failure_class: 'business',
|
|
470
|
-
action: 'Load the named record/list and compare visible data to the expected persisted source.',
|
|
471
|
-
proof_required: 'Visible data and persisted data match the customer expectation.',
|
|
472
|
-
required_artifacts: ['expected source record', 'visible DOM/data snapshot', 'persisted data comparison'],
|
|
473
|
-
acceptance_gate: 'aiqa_business_assertion',
|
|
474
|
-
false_pass_blockers: ['non-empty page only', 'wrong account/customer context', 'sample substitute for named record']
|
|
475
|
-
}, {
|
|
476
|
-
issue_class: 'filter_query_mismatch',
|
|
477
|
-
probe_type: 'issue_class_probe',
|
|
478
|
-
failure_class: 'business',
|
|
479
|
-
action: 'Apply the reported filter/query inputs and assert included/excluded rows or counts.',
|
|
480
|
-
proof_required: 'Returned rows/counts match the expected dataset and exclude the wrong records.',
|
|
481
|
-
required_artifacts: ['filter input trace', 'included/excluded row proof', 'query or publication result proof'],
|
|
482
|
-
acceptance_gate: 'aiqa_business_assertion',
|
|
483
|
-
false_pass_blockers: ['filter control visible only', 'route screenshot without row proof']
|
|
484
|
-
}, {
|
|
485
|
-
issue_class: 'invoice_pdf_export',
|
|
486
|
-
probe_type: 'issue_class_probe',
|
|
487
|
-
failure_class: 'business',
|
|
488
|
-
action: 'Generate the invoice/PDF/export and inspect the generated artifact.',
|
|
489
|
-
proof_required: 'Generated artifact contains the expected customer-visible rows, totals, fields, or file output.',
|
|
490
|
-
required_artifacts: ['export trigger trace', 'generated file artifact path', 'parsed artifact content proof'],
|
|
491
|
-
acceptance_gate: 'aiqa_business_assertion',
|
|
492
|
-
false_pass_blockers: ['download button visible only', 'unparsed file exists only']
|
|
493
|
-
}, {
|
|
494
|
-
issue_class: 'upload_import',
|
|
495
|
-
probe_type: 'issue_class_probe',
|
|
496
|
-
failure_class: 'business',
|
|
497
|
-
action: 'Run the upload/import workflow with a representative file and assert parsed plus persisted results.',
|
|
498
|
-
proof_required: 'Import result message and persisted rows/counts changed as expected.',
|
|
499
|
-
required_artifacts: ['input file fixture', 'import result message', 'persisted row/count delta'],
|
|
500
|
-
acceptance_gate: 'aiqa_business_assertion',
|
|
501
|
-
false_pass_blockers: ['file picker opens only', 'upload toast without persisted delta']
|
|
502
|
-
}, {
|
|
503
|
-
issue_class: 'route_auth_hydration',
|
|
504
|
-
probe_type: 'issue_class_probe',
|
|
505
|
-
failure_class: 'route',
|
|
506
|
-
action: 'Open the route as the affected user and prove authenticated hydration reaches the functional screen.',
|
|
507
|
-
proof_required: 'Hydrated route shows required controls/data for the affected account and no shell-only fallback.',
|
|
508
|
-
required_artifacts: ['auth context', 'hydrated DOM proof', 'console/network error log'],
|
|
509
|
-
acceptance_gate: 'aiqa_business_assertion',
|
|
510
|
-
false_pass_blockers: ['home route proof', 'login shell proof', 'header-only screenshot']
|
|
511
|
-
}, {
|
|
512
|
-
issue_class: 'slow_query_performance',
|
|
513
|
-
probe_type: 'issue_class_probe',
|
|
514
|
-
failure_class: 'business',
|
|
515
|
-
action: 'Run the reported query/workflow with timing/log evidence before and after the fix.',
|
|
516
|
-
proof_required: 'Timing improves or meets target while result equivalence is preserved.',
|
|
517
|
-
required_artifacts: ['before timing', 'after timing', 'result equivalence proof', 'query/log trace'],
|
|
518
|
-
acceptance_gate: 'aiqa_business_assertion',
|
|
519
|
-
false_pass_blockers: ['compile pass only', 'single timing without before/after comparison']
|
|
520
|
-
}];
|
|
521
|
-
function normalizeSupportSimilarCaseSelection(value, input) {
|
|
522
|
-
var object = cleanObject(value);
|
|
523
|
-
if (Array.isArray(value)) {
|
|
524
|
-
return selectResolveIOSupportSimilarCaseHints(__assign(__assign({}, input), { candidates: value }));
|
|
525
|
-
}
|
|
526
|
-
if (object.ranked || object.similarTickets || object.similar_tickets || object.similarCommits || object.similar_commits) {
|
|
527
|
-
var normalizeRanked = function (entries) { return (Array.isArray(entries) ? entries : [])
|
|
528
|
-
.map(function (entry) {
|
|
529
|
-
var candidate = normalizeResolveIOSupportSimilarCaseCandidate(entry);
|
|
530
|
-
if (!candidate) {
|
|
531
|
-
return undefined;
|
|
532
|
-
}
|
|
533
|
-
var signals = cleanList((entry || {}).structuredSignals || (entry || {}).structured_signals, 10, 160);
|
|
534
|
-
return {
|
|
535
|
-
id: candidate.id,
|
|
536
|
-
ticketNumber: candidate.ticketNumber,
|
|
537
|
-
title: candidate.title,
|
|
538
|
-
outcome: candidate.outcome,
|
|
539
|
-
issueClass: normalizeIssueClass(candidate.issueClass) || candidate.issueClass,
|
|
540
|
-
ownerFiles: candidate.ownerFiles.slice(0, 8),
|
|
541
|
-
commitSha: candidate.commitSha,
|
|
542
|
-
commitMessage: candidate.commitMessage,
|
|
543
|
-
reason: cleanText((entry || {}).reason || signals.join('; '), 500),
|
|
544
|
-
source: candidate.source,
|
|
545
|
-
score: Number((entry || {}).score || 0),
|
|
546
|
-
structuredSignals: signals,
|
|
547
|
-
advisoryOnly: true
|
|
548
|
-
};
|
|
549
|
-
})
|
|
550
|
-
.filter(function (entry) { return Boolean(entry); })
|
|
551
|
-
.slice(0, Math.max(1, Math.min(12, Number(input.limit || 6)))); };
|
|
552
|
-
var rankedHints = normalizeRanked(object.ranked);
|
|
553
|
-
var ticketHints = normalizeRanked(object.similarTickets || object.similar_tickets);
|
|
554
|
-
var commitHints = normalizeRanked(object.similarCommits || object.similar_commits);
|
|
555
|
-
var merged = rankedHints.length
|
|
556
|
-
? rankedHints
|
|
557
|
-
: __spreadArray(__spreadArray([], __read(ticketHints), false), __read(commitHints), false).sort(function (a, b) { return b.score - a.score; })
|
|
558
|
-
.slice(0, Math.max(1, Math.min(12, Number(input.limit || 6))));
|
|
559
|
-
return {
|
|
560
|
-
ranked: merged,
|
|
561
|
-
similarTickets: ticketHints.length ? ticketHints : merged.filter(function (hint) { return hint.source !== 'git_commit'; }),
|
|
562
|
-
similarCommits: commitHints.length ? commitHints : merged.filter(function (hint) { return hint.source === 'git_commit' || !!hint.commitSha; }),
|
|
563
|
-
ignoredCount: Number(object.ignoredCount || object.ignored_count || 0),
|
|
564
|
-
generatedAt: cleanText(object.generatedAt || object.generated_at, 120) || isoNow(input.now)
|
|
565
|
-
};
|
|
566
|
-
}
|
|
567
|
-
return selectResolveIOSupportSimilarCaseHints(input);
|
|
568
|
-
}
|
|
569
|
-
function buildResolveIOSupportDiagnosisEvidencePack(input) {
|
|
570
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
571
|
-
if (input === void 0) { input = {}; }
|
|
572
|
-
var bundle = input.bundle;
|
|
573
|
-
var activeMicrotask = bundle
|
|
574
|
-
? selectResolveIOSupportV5ActiveMicrotask(bundle.supportV5MicrotaskLedger || [], bundle.supportV5ActiveMicrotaskId)
|
|
575
|
-
: undefined;
|
|
576
|
-
var diagnosisSource = input.diagnosisGate || (bundle === null || bundle === void 0 ? void 0 : bundle.supportV5DiagnosisGate);
|
|
577
|
-
var validation = validateResolveIOSupportDiagnosisGate(diagnosisSource);
|
|
578
|
-
var normalizedDiagnosis = validation.normalized;
|
|
579
|
-
var ownerFileHints = cleanList(__spreadArray(__spreadArray(__spreadArray([], __read(cleanList(input.ownerFiles, 16, 500)), false), __read(cleanList(normalizedDiagnosis === null || normalizedDiagnosis === void 0 ? void 0 : normalizedDiagnosis.owner_files, 16, 500)), false), __read(cleanList(activeMicrotask === null || activeMicrotask === void 0 ? void 0 : activeMicrotask.targetFiles, 8, 500)), false), 16, 500).map(normalizeOwnerFilePath).filter(Boolean);
|
|
580
|
-
var issueClassHint = normalizeIssueClass(input.issueClass || (normalizedDiagnosis === null || normalizedDiagnosis === void 0 ? void 0 : normalizedDiagnosis.issue_class));
|
|
581
|
-
var text = cleanText([
|
|
582
|
-
input.text,
|
|
583
|
-
bundle === null || bundle === void 0 ? void 0 : bundle.supportV5ScopeDigest,
|
|
584
|
-
(_a = bundle === null || bundle === void 0 ? void 0 : bundle.supportV5SupervisorState) === null || _a === void 0 ? void 0 : _a.currentGoal,
|
|
585
|
-
(_b = input.ticketContext) === null || _b === void 0 ? void 0 : _b.title,
|
|
586
|
-
(_c = input.ticketContext) === null || _c === void 0 ? void 0 : _c.subject,
|
|
587
|
-
(_d = input.ticketContext) === null || _d === void 0 ? void 0 : _d.summary
|
|
588
|
-
].filter(Boolean).join(' '), 3000);
|
|
589
|
-
var similarInput = {
|
|
590
|
-
issueClass: issueClassHint || (normalizedDiagnosis === null || normalizedDiagnosis === void 0 ? void 0 : normalizedDiagnosis.issue_class),
|
|
591
|
-
ownerFiles: ownerFileHints,
|
|
592
|
-
text: text,
|
|
593
|
-
candidates: Array.isArray(input.similarCaseHints) ? input.similarCaseHints : [],
|
|
594
|
-
limit: 6,
|
|
595
|
-
now: input.now
|
|
596
|
-
};
|
|
597
|
-
var similarCaseSelection = normalizeSupportSimilarCaseSelection(input.similarCaseHints, similarInput);
|
|
598
|
-
var status = validation.valid
|
|
599
|
-
? 'diagnosis_ready'
|
|
600
|
-
: validation.status === 'blocked'
|
|
601
|
-
? 'blocked'
|
|
602
|
-
: 'needs_diagnosis';
|
|
603
|
-
var generatedAt = isoNow(input.now);
|
|
604
|
-
return {
|
|
605
|
-
packId: "support-diagnosis-pack-".concat(hashResolveIOSupportV5Evidence({
|
|
606
|
-
status: status,
|
|
607
|
-
issueClassHint: issueClassHint,
|
|
608
|
-
ownerFileHints: ownerFileHints,
|
|
609
|
-
blockers: validation.blockers,
|
|
610
|
-
text: text,
|
|
611
|
-
activeMicrotaskId: activeMicrotask === null || activeMicrotask === void 0 ? void 0 : activeMicrotask.microtaskId
|
|
612
|
-
})),
|
|
613
|
-
status: status,
|
|
614
|
-
readOnly: true,
|
|
615
|
-
sourceEditsAllowed: false,
|
|
616
|
-
rootCauseFirstRequired: true,
|
|
617
|
-
requiredOutputKey: 'support_diagnosis_gate',
|
|
618
|
-
requiredFields: SUPPORT_DIAGNOSIS_GATE_REQUIRED_FIELDS,
|
|
619
|
-
requiredEvidence: SUPPORT_DIAGNOSIS_REQUIRED_EVIDENCE,
|
|
620
|
-
forbiddenActions: SUPPORT_DIAGNOSIS_FORBIDDEN_ACTIONS,
|
|
621
|
-
diagnosisValid: validation.valid,
|
|
622
|
-
diagnosisStatus: validation.status,
|
|
623
|
-
validationBlockers: validation.blockers,
|
|
624
|
-
issueClassHint: issueClassHint || undefined,
|
|
625
|
-
ownerFileHints: ownerFileHints.slice(0, 12),
|
|
626
|
-
activeMicrotaskId: activeMicrotask === null || activeMicrotask === void 0 ? void 0 : activeMicrotask.microtaskId,
|
|
627
|
-
similarCaseSelection: similarCaseSelection,
|
|
628
|
-
issueClassProbeCatalog: SUPPORT_ISSUE_CLASS_PROBE_CATALOG,
|
|
629
|
-
structuredFacts: {
|
|
630
|
-
currentDiagnosisStatus: validation.status,
|
|
631
|
-
currentDiagnosisValid: validation.valid,
|
|
632
|
-
reproductionStatus: normalizedDiagnosis === null || normalizedDiagnosis === void 0 ? void 0 : normalizedDiagnosis.issue_case.reproduction_status,
|
|
633
|
-
evidenceTypes: ((_e = validation.evidenceQuality) === null || _e === void 0 ? void 0 : _e.evidenceTypes) || [],
|
|
634
|
-
reproductionEvidenceTypes: ((_f = validation.evidenceQuality) === null || _f === void 0 ? void 0 : _f.reproductionEvidenceTypes) || [],
|
|
635
|
-
rootCauseEvidenceTypes: ((_g = validation.evidenceQuality) === null || _g === void 0 ? void 0 : _g.rootCauseEvidenceTypes) || [],
|
|
636
|
-
artifactBackedEvidenceCount: ((_h = validation.evidenceQuality) === null || _h === void 0 ? void 0 : _h.artifactBackedEvidenceCount) || 0,
|
|
637
|
-
similarHintCount: similarCaseSelection.ranked.length,
|
|
638
|
-
similarHintsAdvisoryOnly: true,
|
|
639
|
-
productRepairBlockedUntilDiagnosisPassed: validation.valid !== true
|
|
640
|
-
},
|
|
641
|
-
generatedAt: generatedAt
|
|
642
|
-
};
|
|
643
|
-
}
|
|
644
|
-
function normalizeSupportDiagnosisBusinessProofContract(value, issueClassHint) {
|
|
645
|
-
var source = cleanObject(value);
|
|
646
|
-
if (!Object.keys(source).length) {
|
|
647
|
-
return undefined;
|
|
648
|
-
}
|
|
649
|
-
var issueClass = normalizeIssueClass(source.issue_class || source.issueClass || issueClassHint)
|
|
650
|
-
|| normalizeIssueClass(issueClassHint)
|
|
651
|
-
|| 'missing_wrong_data';
|
|
652
|
-
return {
|
|
653
|
-
issue_class: issueClass,
|
|
654
|
-
setup_state: pickText(source, ['setup_state', 'setupState', 'before', 'precondition'], 1000),
|
|
655
|
-
action_under_test: pickText(source, ['action_under_test', 'actionUnderTest', 'action', 'steps'], 1000),
|
|
656
|
-
expected_business_state_change: pickText(source, ['expected_business_state_change', 'expectedBusinessStateChange', 'expected_change', 'expectedChange', 'after'], 1000),
|
|
657
|
-
prohibited_false_pass: pickText(source, ['prohibited_false_pass', 'prohibitedFalsePass', 'false_pass', 'falsePass'], 1000),
|
|
658
|
-
proof_artifacts: cleanList(source.proof_artifacts || source.proofArtifacts || source.artifacts || source.artifact_paths || source.artifactPaths, 10, 500),
|
|
659
|
-
data_or_dom_assertion: pickText(source, ['data_or_dom_assertion', 'dataOrDomAssertion', 'data_assertion', 'dataAssertion', 'dom_assertion', 'domAssertion', 'assertion'], 1000)
|
|
660
|
-
};
|
|
661
|
-
}
|
|
662
|
-
function normalizeOwnerFilePath(value) {
|
|
663
|
-
return cleanText(value, 500)
|
|
664
|
-
.replace(/\\/g, '/')
|
|
665
|
-
.replace(/^\.\/+/, '')
|
|
666
|
-
.replace(/^\/+/, '')
|
|
667
|
-
.replace(/\s+$/g, '');
|
|
668
|
-
}
|
|
669
|
-
function ownerFileLooksBroad(value) {
|
|
670
|
-
var normalized = normalizeOwnerFilePath(value);
|
|
671
|
-
return !normalized
|
|
672
|
-
|| normalized.includes('*')
|
|
673
|
-
|| normalized.endsWith('/')
|
|
674
|
-
|| !/\.[a-z0-9]+$/i.test(normalized)
|
|
675
|
-
|| /^(\.|src|server|angular|client|app|lib|packages?)$/i.test(normalized)
|
|
676
|
-
|| /(^|\/)(node_modules|dist|build|coverage|\.git)(\/|$)/i.test(normalized);
|
|
677
|
-
}
|
|
678
|
-
function proofPlanLooksRouteOnly(proofPlan) {
|
|
679
|
-
var assertionText = cleanText([
|
|
680
|
-
proofPlan.business_assertion,
|
|
681
|
-
proofPlan.action,
|
|
682
|
-
proofPlan.after,
|
|
683
|
-
proofPlan.data_assertion,
|
|
684
|
-
proofPlan.artifact_expectation
|
|
685
|
-
].filter(Boolean).join(' '), 3000).toLowerCase();
|
|
686
|
-
if (!assertionText) {
|
|
687
|
-
return false;
|
|
688
|
-
}
|
|
689
|
-
var routeOnlySignal = /\b(route|page|screen|dashboard|url|component|shell)\b/.test(assertionText)
|
|
690
|
-
&& /\b(loads?|loaded|renders?|rendered|opens?|opened|visible|visibility|hydrates?|hydrated|screenshot)\b/.test(assertionText);
|
|
691
|
-
var businessSignal = /\b(save|saved|persist|persisted|create|created|update|updated|delete|deleted|filter|filtered|exclude|excluded|include|included|row|rows|record|records|count|counts|total|totals|value|values|data|mongo|query|result|results|invoice|pdf|export|download|upload|import|dropdown|selection|selected|form|submit|submitted|validation|error message|customer|account|user|permission|auth|control|button|status|calculation|performance|duration|latency)\b/.test(assertionText);
|
|
692
|
-
return routeOnlySignal && !businessSignal;
|
|
693
|
-
}
|
|
694
|
-
var SUPPORT_REPRODUCTION_EVIDENCE_TYPES = new Set(['browser', 'mongo', 'log', 'qa']);
|
|
695
|
-
var SUPPORT_ROOT_CAUSE_EVIDENCE_TYPES = new Set(['browser', 'mongo', 'log', 'code', 'commit', 'qa']);
|
|
696
|
-
var SUPPORT_ARTIFACT_RECOMMENDED_EVIDENCE_TYPES = new Set(['browser', 'mongo', 'log', 'qa']);
|
|
697
|
-
function evaluateResolveIOSupportDiagnosisEvidenceQuality(value) {
|
|
698
|
-
var normalized = normalizeResolveIOSupportDiagnosisGate(value);
|
|
699
|
-
if (!normalized) {
|
|
700
|
-
return {
|
|
701
|
-
valid: false,
|
|
702
|
-
blockers: ['SupportDiagnosisGate is missing.'],
|
|
703
|
-
evidenceTypes: [],
|
|
704
|
-
reproductionEvidenceTypes: [],
|
|
705
|
-
rootCauseEvidenceTypes: [],
|
|
706
|
-
artifactBackedEvidenceCount: 0,
|
|
707
|
-
hasTicketContext: false,
|
|
708
|
-
hasRootCauseEvidence: false,
|
|
709
|
-
hasReproductionEvidence: false
|
|
710
|
-
};
|
|
711
|
-
}
|
|
712
|
-
var evidence = normalized.evidence || [];
|
|
713
|
-
var evidenceTypes = Array.from(new Set(evidence.map(function (entry) { return entry.type; })));
|
|
714
|
-
var reproductionEvidenceTypes = Array.from(new Set(evidence
|
|
715
|
-
.filter(function (entry) { return SUPPORT_REPRODUCTION_EVIDENCE_TYPES.has(entry.type); })
|
|
716
|
-
.map(function (entry) { return entry.type; })));
|
|
717
|
-
var rootCauseEvidenceTypes = Array.from(new Set(evidence
|
|
718
|
-
.filter(function (entry) { return SUPPORT_ROOT_CAUSE_EVIDENCE_TYPES.has(entry.type); })
|
|
719
|
-
.map(function (entry) { return entry.type; })));
|
|
720
|
-
var artifactBackedEvidenceCount = evidence.filter(function (entry) { return !!entry.artifactPath; }).length;
|
|
721
|
-
var hasTicketContext = evidence.some(function (entry) { return entry.type === 'ticket'; })
|
|
722
|
-
|| Boolean(normalized.issue_case.customer_complaint && normalized.issue_case.account_customer_context);
|
|
723
|
-
var hasRootCauseEvidence = rootCauseEvidenceTypes.length > 0;
|
|
724
|
-
var hasReproductionEvidence = reproductionEvidenceTypes.length > 0;
|
|
725
|
-
var blockers = [];
|
|
726
|
-
if (!evidence.length) {
|
|
727
|
-
blockers.push('Diagnosis evidence must include typed ticket/code/browser/log/Mongo/QA proof.');
|
|
728
|
-
}
|
|
729
|
-
if (!hasRootCauseEvidence) {
|
|
730
|
-
blockers.push('Diagnosis evidence must include at least one non-ticket root-cause proof item: code, commit, browser, Mongo, log, or QA.');
|
|
731
|
-
}
|
|
732
|
-
if (!hasTicketContext) {
|
|
733
|
-
blockers.push('Diagnosis evidence must preserve the customer/ticket context used for reproduction.');
|
|
734
|
-
}
|
|
735
|
-
if (normalized.issue_case.reproduction_status === 'reproduced' && !hasReproductionEvidence) {
|
|
736
|
-
blockers.push('Diagnosis reproduced issue_case requires browser, Mongo, log, or QA reproduction evidence before repair.');
|
|
737
|
-
}
|
|
738
|
-
if (normalized.issue_case.reproduction_status === 'blocked'
|
|
739
|
-
&& !normalized.issue_case.reproduction_blocker) {
|
|
740
|
-
blockers.push('Diagnosis blocked reproduction requires issue_case.reproduction_blocker.');
|
|
741
|
-
}
|
|
742
|
-
var unartifactedRuntimeEvidence = evidence.filter(function (entry) { return SUPPORT_ARTIFACT_RECOMMENDED_EVIDENCE_TYPES.has(entry.type) && !entry.artifactPath; });
|
|
743
|
-
if (unartifactedRuntimeEvidence.length) {
|
|
744
|
-
blockers.push("Diagnosis runtime evidence must include artifactPath for replayable proof: ".concat(unartifactedRuntimeEvidence.map(function (entry) { return entry.type; }).join(', '), "."));
|
|
745
|
-
}
|
|
746
|
-
if (normalized.issue_case.reproduction_status === 'reproduced' && artifactBackedEvidenceCount < 1) {
|
|
747
|
-
blockers.push('Diagnosis reproduced issue_case requires at least one artifact-backed evidence item.');
|
|
748
|
-
}
|
|
749
|
-
return {
|
|
750
|
-
valid: blockers.length === 0,
|
|
751
|
-
blockers: blockers,
|
|
752
|
-
evidenceTypes: evidenceTypes,
|
|
753
|
-
reproductionEvidenceTypes: reproductionEvidenceTypes,
|
|
754
|
-
rootCauseEvidenceTypes: rootCauseEvidenceTypes,
|
|
755
|
-
artifactBackedEvidenceCount: artifactBackedEvidenceCount,
|
|
756
|
-
hasTicketContext: hasTicketContext,
|
|
757
|
-
hasRootCauseEvidence: hasRootCauseEvidence,
|
|
758
|
-
hasReproductionEvidence: hasReproductionEvidence
|
|
759
|
-
};
|
|
760
|
-
}
|
|
761
|
-
function normalizeResolveIOSupportDiagnosisGate(value, now) {
|
|
762
|
-
var source = cleanObject(value);
|
|
763
|
-
if (!Object.keys(source).length) {
|
|
764
|
-
return undefined;
|
|
765
|
-
}
|
|
766
|
-
var issueCaseSource = cleanObject(source.issue_case || source.issueCase);
|
|
767
|
-
var hypothesisSource = cleanObject(source.accepted_hypothesis || source.acceptedHypothesis);
|
|
768
|
-
var failingPathSource = cleanObject(source.failing_path || source.failingPath);
|
|
769
|
-
var proofPlanSource = cleanObject(source.proof_plan || source.proofPlan);
|
|
770
|
-
var issueClass = normalizeIssueClass(source.issue_class || source.issueClass);
|
|
771
|
-
var businessProofContract = normalizeSupportDiagnosisBusinessProofContract(proofPlanSource.business_proof_contract || proofPlanSource.businessProofContract || source.business_proof_contract || source.businessProofContract, issueClass || source.issue_class || source.issueClass);
|
|
772
|
-
var ownerFiles = cleanList(source.owner_files || source.ownerFiles, 20, 500)
|
|
773
|
-
.map(normalizeOwnerFilePath)
|
|
774
|
-
.filter(Boolean);
|
|
775
|
-
var gate = {
|
|
776
|
-
issue_case: {
|
|
777
|
-
customer_complaint: pickText(issueCaseSource, ['customer_complaint', 'customerComplaint', 'complaint', 'request', 'summary'], 1200),
|
|
778
|
-
expected_result: pickText(issueCaseSource, ['expected_result', 'expectedResult', 'expected'], 1000),
|
|
779
|
-
observed_result: pickText(issueCaseSource, ['observed_result', 'observedResult', 'observed', 'actual'], 1000),
|
|
780
|
-
route_module: pickText(issueCaseSource, ['route_module', 'routeModule', 'route', 'module', 'screen'], 500),
|
|
781
|
-
account_customer_context: pickText(issueCaseSource, ['account_customer_context', 'accountCustomerContext', 'account', 'customer', 'user', 'context'], 800),
|
|
782
|
-
reproduction_status: normalizeReproductionStatus(issueCaseSource.reproduction_status || issueCaseSource.reproductionStatus || source.reproduction_status),
|
|
783
|
-
reproduction_blocker: pickText(issueCaseSource, ['reproduction_blocker', 'reproductionBlocker', 'blocked_reason', 'blockedReason'], 1000)
|
|
784
|
-
},
|
|
785
|
-
issue_class: issueClass || 'missing_wrong_data',
|
|
786
|
-
accepted_hypothesis: {
|
|
787
|
-
statement: pickText(hypothesisSource, ['statement', 'hypothesis', 'root_cause', 'rootCause', 'summary'], 1200)
|
|
788
|
-
|| (typeof source.accepted_hypothesis === 'string' ? cleanText(source.accepted_hypothesis, 1200) : ''),
|
|
789
|
-
falsifiable_test: pickText(hypothesisSource, ['falsifiable_test', 'falsifiableTest', 'test', 'proof', 'falsifier'], 1000),
|
|
790
|
-
evidence: cleanList(hypothesisSource.evidence || source.hypothesis_evidence || source.hypothesisEvidence, 10, 800)
|
|
791
|
-
},
|
|
792
|
-
rejected_alternatives: cleanList(source.rejected_alternatives || source.rejectedAlternatives, 10, 700),
|
|
793
|
-
failing_path: {
|
|
794
|
-
frontend: pickText(failingPathSource, ['frontend', 'frontend_path', 'frontendPath', 'eventPath'], 700),
|
|
795
|
-
backend: pickText(failingPathSource, ['backend', 'backend_path', 'backendPath', 'methodPublicationPath'], 700),
|
|
796
|
-
shared_library: pickText(failingPathSource, ['shared_library', 'sharedLibrary', 'library', 'lib'], 700),
|
|
797
|
-
data_query: pickText(failingPathSource, ['data_query', 'dataQuery', 'query'], 700),
|
|
798
|
-
description: pickText(failingPathSource, ['description', 'path', 'summary'], 1200) || cleanText(source.failing_path, 1200)
|
|
799
|
-
},
|
|
800
|
-
owner_files: ownerFiles,
|
|
801
|
-
proof_plan: {
|
|
802
|
-
before: pickText(proofPlanSource, ['before', 'before_state', 'beforeState', 'precondition'], 1000),
|
|
803
|
-
before_state_unavailable_reason: pickText(proofPlanSource, ['before_state_unavailable_reason', 'beforeStateUnavailableReason', 'before_unavailable_reason'], 1000),
|
|
804
|
-
action: pickText(proofPlanSource, ['action', 'browser_action', 'browserAction', 'steps'], 1000),
|
|
805
|
-
after: pickText(proofPlanSource, ['after', 'after_state', 'afterState', 'expected_after'], 1000),
|
|
806
|
-
business_assertion: pickText(proofPlanSource, ['business_assertion', 'businessAssertion', 'assertion'], 1000),
|
|
807
|
-
route: pickText(proofPlanSource, ['route', 'url'], 500),
|
|
808
|
-
data_assertion: pickText(proofPlanSource, ['data_assertion', 'dataAssertion', 'mongo_delta', 'mongoDelta'], 1000),
|
|
809
|
-
artifact_expectation: pickText(proofPlanSource, ['artifact_expectation', 'artifactExpectation', 'artifact', 'screenshot'], 1000),
|
|
810
|
-
business_proof_contract: businessProofContract
|
|
811
|
-
},
|
|
812
|
-
similar_tickets: normalizeSupportDiagnosisHints(source.similar_tickets || source.similarTickets),
|
|
813
|
-
similar_commits: normalizeSupportDiagnosisHints(source.similar_commits || source.similarCommits),
|
|
814
|
-
evidence: normalizeSupportDiagnosisEvidence(source.evidence),
|
|
815
|
-
status: cleanText(source.status, 80).toLowerCase() || 'incomplete',
|
|
816
|
-
updatedAt: isoNow(now || source.updatedAt || source.updated_at)
|
|
817
|
-
};
|
|
818
|
-
if (!['missing', 'incomplete', 'blocked', 'passed'].includes(gate.status)) {
|
|
819
|
-
gate.status = 'incomplete';
|
|
820
|
-
}
|
|
821
|
-
return gate;
|
|
822
|
-
}
|
|
823
|
-
function extractResolveIOSupportDiagnosisGateFromText(value, now) {
|
|
824
|
-
var e_4, _a;
|
|
825
|
-
var text = String(value || '').trim();
|
|
826
|
-
if (!text) {
|
|
827
|
-
return undefined;
|
|
828
|
-
}
|
|
829
|
-
var candidates = [];
|
|
830
|
-
var fenced = Array.from(text.matchAll(/```(?:json)?\s*([\s\S]*?)```/gi)).map(function (match) { return match[1]; });
|
|
831
|
-
candidates.push.apply(candidates, __spreadArray([], __read(fenced), false));
|
|
832
|
-
var jsonBlock = text.match(/\{[\s\S]*\}/);
|
|
833
|
-
if (jsonBlock) {
|
|
834
|
-
candidates.push(jsonBlock[0]);
|
|
835
|
-
}
|
|
836
|
-
try {
|
|
837
|
-
for (var candidates_1 = __values(candidates), candidates_1_1 = candidates_1.next(); !candidates_1_1.done; candidates_1_1 = candidates_1.next()) {
|
|
838
|
-
var candidate = candidates_1_1.value;
|
|
839
|
-
try {
|
|
840
|
-
var parsed = JSON.parse(candidate);
|
|
841
|
-
var wrapped = (parsed === null || parsed === void 0 ? void 0 : parsed.support_diagnosis_gate) || (parsed === null || parsed === void 0 ? void 0 : parsed.supportDiagnosisGate) || (parsed === null || parsed === void 0 ? void 0 : parsed.diagnosis_gate) || (parsed === null || parsed === void 0 ? void 0 : parsed.diagnosisGate) || parsed;
|
|
842
|
-
var normalized = normalizeResolveIOSupportDiagnosisGate(wrapped, now);
|
|
843
|
-
if (normalized) {
|
|
844
|
-
return normalized;
|
|
845
|
-
}
|
|
846
|
-
}
|
|
847
|
-
catch (_b) {
|
|
848
|
-
// Continue trying less exact JSON candidates.
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
853
|
-
finally {
|
|
854
|
-
try {
|
|
855
|
-
if (candidates_1_1 && !candidates_1_1.done && (_a = candidates_1.return)) _a.call(candidates_1);
|
|
856
|
-
}
|
|
857
|
-
finally { if (e_4) throw e_4.error; }
|
|
858
|
-
}
|
|
859
|
-
return undefined;
|
|
860
|
-
}
|
|
861
|
-
function validateResolveIOSupportDiagnosisGate(value, options) {
|
|
862
|
-
if (options === void 0) { options = {}; }
|
|
863
|
-
var normalized = normalizeResolveIOSupportDiagnosisGate(value);
|
|
864
|
-
if (!normalized) {
|
|
865
|
-
return { valid: false, status: 'missing', blockers: ['SupportDiagnosisGate is missing.'] };
|
|
866
|
-
}
|
|
867
|
-
var blockers = [];
|
|
868
|
-
var maxOwnerFiles = Math.max(1, Number(options.maxOwnerFiles || 8) || 8);
|
|
869
|
-
if (!normalized.issue_case.customer_complaint) {
|
|
870
|
-
blockers.push('Diagnosis issue_case.customer_complaint is required.');
|
|
871
|
-
}
|
|
872
|
-
if (!normalized.issue_case.expected_result) {
|
|
873
|
-
blockers.push('Diagnosis issue_case.expected_result is required.');
|
|
874
|
-
}
|
|
875
|
-
if (!normalized.issue_case.observed_result) {
|
|
876
|
-
blockers.push('Diagnosis issue_case.observed_result is required.');
|
|
877
|
-
}
|
|
878
|
-
if (!normalized.issue_case.route_module) {
|
|
879
|
-
blockers.push('Diagnosis issue_case.route_module is required.');
|
|
880
|
-
}
|
|
881
|
-
if (!normalized.issue_case.account_customer_context) {
|
|
882
|
-
blockers.push('Diagnosis issue_case.account_customer_context is required.');
|
|
883
|
-
}
|
|
884
|
-
if (normalized.issue_case.reproduction_status === 'blocked' && !normalized.issue_case.reproduction_blocker) {
|
|
885
|
-
blockers.push('Diagnosis blocked reproduction requires issue_case.reproduction_blocker.');
|
|
886
|
-
}
|
|
887
|
-
if (!normalizeIssueClass(normalized.issue_class)) {
|
|
888
|
-
blockers.push('Diagnosis issue_class must be one of the supported issue-class probes.');
|
|
889
|
-
}
|
|
890
|
-
if (!normalized.accepted_hypothesis.statement) {
|
|
891
|
-
blockers.push('Diagnosis accepted_hypothesis.statement is required.');
|
|
892
|
-
}
|
|
893
|
-
if (!normalized.accepted_hypothesis.falsifiable_test) {
|
|
894
|
-
blockers.push('Diagnosis accepted_hypothesis.falsifiable_test is required.');
|
|
895
|
-
}
|
|
896
|
-
if (!normalized.accepted_hypothesis.evidence.length) {
|
|
897
|
-
blockers.push('Diagnosis accepted_hypothesis.evidence must cite proof.');
|
|
898
|
-
}
|
|
899
|
-
if (!normalized.rejected_alternatives.length) {
|
|
900
|
-
blockers.push('Diagnosis rejected_alternatives must include at least one rejected theory.');
|
|
901
|
-
}
|
|
902
|
-
if (!normalized.failing_path.description
|
|
903
|
-
&& !normalized.failing_path.frontend
|
|
904
|
-
&& !normalized.failing_path.backend
|
|
905
|
-
&& !normalized.failing_path.shared_library
|
|
906
|
-
&& !normalized.failing_path.data_query) {
|
|
907
|
-
blockers.push('Diagnosis failing_path must identify frontend, backend, query, shared library, or path description.');
|
|
908
|
-
}
|
|
909
|
-
if (!normalized.owner_files.length) {
|
|
910
|
-
blockers.push('Diagnosis owner_files must contain the small editable file set.');
|
|
911
|
-
}
|
|
912
|
-
if (normalized.owner_files.length > maxOwnerFiles) {
|
|
913
|
-
blockers.push("Diagnosis owner_files has ".concat(normalized.owner_files.length, " entries; maximum is ").concat(maxOwnerFiles, "."));
|
|
914
|
-
}
|
|
915
|
-
var broadFiles = normalized.owner_files.filter(ownerFileLooksBroad);
|
|
916
|
-
if (broadFiles.length) {
|
|
917
|
-
blockers.push("Diagnosis owner_files contains broad or unsafe path(s): ".concat(broadFiles.join(', '), "."));
|
|
918
|
-
}
|
|
919
|
-
if (!normalized.proof_plan.before && !normalized.proof_plan.before_state_unavailable_reason) {
|
|
920
|
-
blockers.push('Diagnosis proof_plan.before is required unless proof_plan.before_state_unavailable_reason explains why before-state proof is impossible.');
|
|
921
|
-
}
|
|
922
|
-
if (!normalized.proof_plan.action) {
|
|
923
|
-
blockers.push('Diagnosis proof_plan.action is required.');
|
|
924
|
-
}
|
|
925
|
-
if (!normalized.proof_plan.after) {
|
|
926
|
-
blockers.push('Diagnosis proof_plan.after is required.');
|
|
927
|
-
}
|
|
928
|
-
if (!normalized.proof_plan.business_assertion) {
|
|
929
|
-
blockers.push('Diagnosis proof_plan.business_assertion is required.');
|
|
930
|
-
}
|
|
931
|
-
if (proofPlanLooksRouteOnly(normalized.proof_plan)) {
|
|
932
|
-
blockers.push('Diagnosis proof_plan cannot be route-load, screen-visible, or screenshot-only; it must name the business state/data/control change that proves the issue is fixed.');
|
|
933
|
-
}
|
|
934
|
-
var proofContract = normalized.proof_plan.business_proof_contract;
|
|
935
|
-
if (!proofContract) {
|
|
936
|
-
blockers.push('Diagnosis proof_plan.business_proof_contract is required.');
|
|
937
|
-
}
|
|
938
|
-
else {
|
|
939
|
-
if (proofContract.issue_class !== normalized.issue_class) {
|
|
940
|
-
blockers.push("Diagnosis proof_plan.business_proof_contract.issue_class (".concat(proofContract.issue_class, ") must match diagnosis issue_class (").concat(normalized.issue_class, ")."));
|
|
941
|
-
}
|
|
942
|
-
if (!proofContract.setup_state) {
|
|
943
|
-
blockers.push('Diagnosis proof_plan.business_proof_contract.setup_state is required.');
|
|
944
|
-
}
|
|
945
|
-
if (!proofContract.action_under_test) {
|
|
946
|
-
blockers.push('Diagnosis proof_plan.business_proof_contract.action_under_test is required.');
|
|
947
|
-
}
|
|
948
|
-
if (!proofContract.expected_business_state_change) {
|
|
949
|
-
blockers.push('Diagnosis proof_plan.business_proof_contract.expected_business_state_change is required.');
|
|
950
|
-
}
|
|
951
|
-
if (!proofContract.prohibited_false_pass) {
|
|
952
|
-
blockers.push('Diagnosis proof_plan.business_proof_contract.prohibited_false_pass is required.');
|
|
953
|
-
}
|
|
954
|
-
if (!proofContract.proof_artifacts.length) {
|
|
955
|
-
blockers.push('Diagnosis proof_plan.business_proof_contract.proof_artifacts must include at least one required artifact.');
|
|
956
|
-
}
|
|
957
|
-
if (!proofContract.data_or_dom_assertion) {
|
|
958
|
-
blockers.push('Diagnosis proof_plan.business_proof_contract.data_or_dom_assertion is required.');
|
|
959
|
-
}
|
|
960
|
-
}
|
|
961
|
-
if (!normalized.evidence.length) {
|
|
962
|
-
blockers.push('Diagnosis evidence must include ticket/code/browser/log/Mongo proof.');
|
|
963
|
-
}
|
|
964
|
-
var evidenceQuality = evaluateResolveIOSupportDiagnosisEvidenceQuality(normalized);
|
|
965
|
-
blockers.push.apply(blockers, __spreadArray([], __read(evidenceQuality.blockers), false));
|
|
966
|
-
normalized.status = blockers.length ? 'incomplete' : 'passed';
|
|
967
|
-
return {
|
|
968
|
-
valid: blockers.length === 0,
|
|
969
|
-
status: normalized.status,
|
|
970
|
-
blockers: blockers,
|
|
971
|
-
normalized: normalized,
|
|
972
|
-
evidenceQuality: evidenceQuality
|
|
973
|
-
};
|
|
974
|
-
}
|
|
975
|
-
function normalizeSupportConfidenceLevel(value) {
|
|
976
|
-
var _a, _b;
|
|
977
|
-
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 === null || value === void 0 ? void 0 : value.category) || value, 80).toLowerCase();
|
|
978
|
-
if (/^high$|^strong$|^accepted$|^a\+?$/.test(normalized)) {
|
|
979
|
-
return 'high';
|
|
980
|
-
}
|
|
981
|
-
if (/^medium$|^moderate$|^review$/.test(normalized)) {
|
|
982
|
-
return 'medium';
|
|
983
|
-
}
|
|
984
|
-
if (/^low$|^weak$|^blocked$|^unknown$/.test(normalized)) {
|
|
985
|
-
return normalized === 'unknown' ? 'unknown' : 'low';
|
|
986
|
-
}
|
|
987
|
-
var score = Number((_b = (_a = value === null || value === void 0 ? void 0 : value.score) !== null && _a !== void 0 ? _a : value === null || value === void 0 ? void 0 : value.confidenceScore) !== null && _b !== void 0 ? _b : value === null || value === void 0 ? void 0 : value.confidence_score);
|
|
988
|
-
if (Number.isFinite(score)) {
|
|
989
|
-
if (score >= 0.8) {
|
|
990
|
-
return 'high';
|
|
991
|
-
}
|
|
992
|
-
if (score >= 0.55) {
|
|
993
|
-
return 'medium';
|
|
994
|
-
}
|
|
995
|
-
return 'low';
|
|
996
|
-
}
|
|
997
|
-
return normalized ? 'unknown' : 'unknown';
|
|
998
|
-
}
|
|
999
|
-
function supportReleaseLooksBlocked(value) {
|
|
1000
|
-
return /\b(fail|failed|error|blocked|missing|empty|stale|denied|timeout)\b/i.test(cleanText(value, 200));
|
|
1001
|
-
}
|
|
1002
|
-
function supportBusinessAssertionPassed(value) {
|
|
1003
|
-
return /^(pass|passed|accepted|business_assertion_passed)$/i.test(cleanText(value, 80));
|
|
1004
|
-
}
|
|
1005
|
-
function supportBusinessAssertionFailed(value) {
|
|
1006
|
-
return /^(fail|failed|blocked|needs_repair|business_assertion_failed)$/i.test(cleanText(value, 80));
|
|
1007
|
-
}
|
|
1008
|
-
function supportBusinessAssertionRouteOnly(value) {
|
|
1009
|
-
return /^(route_probe_pass|route_only_pass|route_pass|route_probe|route_loaded)$/i.test(cleanText(value, 80));
|
|
1010
|
-
}
|
|
1011
|
-
function normalizeSupportBusinessProofAssertions(input) {
|
|
1012
|
-
var e_5, _a;
|
|
1013
|
-
var gate = normalizeResolveIOSupportDiagnosisGate(input.diagnosisGate);
|
|
1014
|
-
var proofPlan = gate === null || gate === void 0 ? void 0 : gate.proof_plan;
|
|
1015
|
-
var proofContract = proofPlan === null || proofPlan === void 0 ? void 0 : proofPlan.business_proof_contract;
|
|
1016
|
-
var artifactPaths = cleanList(input.businessProofArtifacts, 30, 500);
|
|
1017
|
-
var assertions = [];
|
|
1018
|
-
try {
|
|
1019
|
-
for (var _b = __values(Array.isArray(input.businessAssertions) ? input.businessAssertions : []), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1020
|
-
var entry = _c.value;
|
|
1021
|
-
var source = cleanObject(entry);
|
|
1022
|
-
if (!Object.keys(source).length) {
|
|
1023
|
-
continue;
|
|
1024
|
-
}
|
|
1025
|
-
var metadata = cleanObject(source.metadata);
|
|
1026
|
-
assertions.push({
|
|
1027
|
-
assertion: pickText(source, ['assertion', 'name', 'workflow', 'expected'], 1000) || (proofPlan === null || proofPlan === void 0 ? void 0 : proofPlan.business_assertion) || 'business assertion',
|
|
1028
|
-
status: cleanText(source.status || source.outcome || source.result, 80),
|
|
1029
|
-
workflow: pickText(source, ['workflow', 'workflowName'], 400),
|
|
1030
|
-
route: pickText(source, ['route', 'url'], 500),
|
|
1031
|
-
before: pickText(source, ['before', 'before_state', 'beforeState'], 1000),
|
|
1032
|
-
action: pickText(source, ['action', 'action_under_test', 'actionUnderTest'], 1000),
|
|
1033
|
-
expected: pickText(source, ['expected', 'expected_business_state_change', 'expectedBusinessStateChange'], 1000),
|
|
1034
|
-
after: pickText(source, ['after', 'after_state', 'afterState'], 1000),
|
|
1035
|
-
observed: pickText(source, ['observed', 'actual'], 1000),
|
|
1036
|
-
dataProof: pickText(source, ['dataProof', 'data_proof', 'proof', 'domProof', 'dom_proof'], 1400),
|
|
1037
|
-
mongoDelta: cleanObject(source.mongoDelta || source.mongo_delta),
|
|
1038
|
-
artifactPaths: cleanList(source.artifactPaths || source.artifact_paths || source.artifacts, 30, 500),
|
|
1039
|
-
message: pickText(source, ['message', 'reason', 'summary'], 1000),
|
|
1040
|
-
acceptanceBlocked: source.acceptanceBlocked === true || source.acceptance_blocked === true || metadata.acceptanceBlocked === true || metadata.acceptance_blocked === true,
|
|
1041
|
-
routeOnly: source.routeOnly === true || source.route_only === true || source.outcome === 'route_only_pass' || source.status === 'route_probe_pass' || metadata.routeOnly === true || metadata.route_only === true,
|
|
1042
|
-
metadata: metadata
|
|
1043
|
-
});
|
|
1044
|
-
}
|
|
1045
|
-
}
|
|
1046
|
-
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
1047
|
-
finally {
|
|
1048
|
-
try {
|
|
1049
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1050
|
-
}
|
|
1051
|
-
finally { if (e_5) throw e_5.error; }
|
|
1052
|
-
}
|
|
1053
|
-
var status = cleanText(input.businessAssertionStatus || input.outcomeLabel, 80);
|
|
1054
|
-
if (!assertions.length && (supportBusinessAssertionPassed(status) || supportBusinessAssertionRouteOnly(status) || supportBusinessAssertionFailed(status))) {
|
|
1055
|
-
assertions.push({
|
|
1056
|
-
assertion: (proofPlan === null || proofPlan === void 0 ? void 0 : proofPlan.business_assertion) || (proofContract === null || proofContract === void 0 ? void 0 : proofContract.data_or_dom_assertion) || 'business assertion',
|
|
1057
|
-
status: status,
|
|
1058
|
-
workflow: proofContract === null || proofContract === void 0 ? void 0 : proofContract.action_under_test,
|
|
1059
|
-
route: (proofPlan === null || proofPlan === void 0 ? void 0 : proofPlan.route) || (gate === null || gate === void 0 ? void 0 : gate.issue_case.route_module),
|
|
1060
|
-
before: proofPlan === null || proofPlan === void 0 ? void 0 : proofPlan.before,
|
|
1061
|
-
action: (proofPlan === null || proofPlan === void 0 ? void 0 : proofPlan.action) || (proofContract === null || proofContract === void 0 ? void 0 : proofContract.action_under_test),
|
|
1062
|
-
expected: (proofContract === null || proofContract === void 0 ? void 0 : proofContract.expected_business_state_change) || (proofPlan === null || proofPlan === void 0 ? void 0 : proofPlan.after),
|
|
1063
|
-
after: proofPlan === null || proofPlan === void 0 ? void 0 : proofPlan.after,
|
|
1064
|
-
observed: '',
|
|
1065
|
-
dataProof: (proofContract === null || proofContract === void 0 ? void 0 : proofContract.data_or_dom_assertion) || (proofPlan === null || proofPlan === void 0 ? void 0 : proofPlan.data_assertion) || '',
|
|
1066
|
-
mongoDelta: {},
|
|
1067
|
-
artifactPaths: artifactPaths,
|
|
1068
|
-
message: '',
|
|
1069
|
-
acceptanceBlocked: supportBusinessAssertionRouteOnly(status),
|
|
1070
|
-
routeOnly: supportBusinessAssertionRouteOnly(status),
|
|
1071
|
-
metadata: {}
|
|
1072
|
-
});
|
|
1073
|
-
}
|
|
1074
|
-
return assertions;
|
|
1075
|
-
}
|
|
1076
|
-
function supportBusinessProofAssertionText(assertion) {
|
|
1077
|
-
return cleanText([
|
|
1078
|
-
assertion.assertion,
|
|
1079
|
-
assertion.workflow,
|
|
1080
|
-
assertion.before,
|
|
1081
|
-
assertion.action,
|
|
1082
|
-
assertion.expected,
|
|
1083
|
-
assertion.after,
|
|
1084
|
-
assertion.observed,
|
|
1085
|
-
assertion.dataProof,
|
|
1086
|
-
assertion.message
|
|
1087
|
-
].filter(Boolean).join(' '), 4000);
|
|
1088
|
-
}
|
|
1089
|
-
function supportBusinessProofAssertionMatchesContract(assertion, gate) {
|
|
1090
|
-
var e_6, _a;
|
|
1091
|
-
if (!gate) {
|
|
1092
|
-
return false;
|
|
1093
|
-
}
|
|
1094
|
-
var metadata = assertion.metadata || {};
|
|
1095
|
-
if (metadata.supportDiagnosisProof === true
|
|
1096
|
-
|| metadata.support_diagnosis_proof === true
|
|
1097
|
-
|| metadata.diagnosisProofPlanMatched === true
|
|
1098
|
-
|| metadata.diagnosis_proof_plan_matched === true
|
|
1099
|
-
|| metadata.proofPlanMatched === true
|
|
1100
|
-
|| metadata.proof_plan_matched === true) {
|
|
1101
|
-
return true;
|
|
1102
|
-
}
|
|
1103
|
-
var proofPlan = gate.proof_plan;
|
|
1104
|
-
var proofContract = proofPlan.business_proof_contract;
|
|
1105
|
-
var requiredParts = [
|
|
1106
|
-
proofPlan.business_assertion,
|
|
1107
|
-
proofPlan.after,
|
|
1108
|
-
proofPlan.data_assertion,
|
|
1109
|
-
proofContract === null || proofContract === void 0 ? void 0 : proofContract.expected_business_state_change,
|
|
1110
|
-
proofContract === null || proofContract === void 0 ? void 0 : proofContract.data_or_dom_assertion
|
|
1111
|
-
].map(function (part) { return cleanText(part, 1000).toLowerCase(); }).filter(function (part) { return part.length >= 12; });
|
|
1112
|
-
var assertionText = supportBusinessProofAssertionText(assertion).toLowerCase();
|
|
1113
|
-
if (!requiredParts.length) {
|
|
1114
|
-
return false;
|
|
1115
|
-
}
|
|
1116
|
-
if (requiredParts.some(function (part) { return assertionText.includes(part); })) {
|
|
1117
|
-
return true;
|
|
1118
|
-
}
|
|
1119
|
-
var proofWords = new Set(requiredParts.join(' ').split(/[^a-z0-9]+/g).filter(function (word) { return word.length >= 5; }));
|
|
1120
|
-
var assertionWords = new Set(assertionText.split(/[^a-z0-9]+/g).filter(function (word) { return word.length >= 5; }));
|
|
1121
|
-
var overlap = 0;
|
|
1122
|
-
try {
|
|
1123
|
-
for (var proofWords_1 = __values(proofWords), proofWords_1_1 = proofWords_1.next(); !proofWords_1_1.done; proofWords_1_1 = proofWords_1.next()) {
|
|
1124
|
-
var word = proofWords_1_1.value;
|
|
1125
|
-
if (assertionWords.has(word)) {
|
|
1126
|
-
overlap += 1;
|
|
1127
|
-
}
|
|
1128
|
-
}
|
|
1129
|
-
}
|
|
1130
|
-
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
1131
|
-
finally {
|
|
1132
|
-
try {
|
|
1133
|
-
if (proofWords_1_1 && !proofWords_1_1.done && (_a = proofWords_1.return)) _a.call(proofWords_1);
|
|
1134
|
-
}
|
|
1135
|
-
finally { if (e_6) throw e_6.error; }
|
|
1136
|
-
}
|
|
1137
|
-
return overlap >= Math.min(5, Math.max(3, Math.ceil(proofWords.size * 0.45)));
|
|
1138
|
-
}
|
|
1139
|
-
function supportBusinessProofArtifactFingerprint(paths) {
|
|
1140
|
-
var normalized = cleanList(paths, 80, 500).sort();
|
|
1141
|
-
return normalized.length ? hashResolveIOSupportV5Evidence({ artifacts: normalized }) : '';
|
|
1142
|
-
}
|
|
1143
|
-
function supportBusinessProofFingerprint(gate, assertion, artifactPaths) {
|
|
1144
|
-
var _a;
|
|
1145
|
-
if (artifactPaths === void 0) { artifactPaths = []; }
|
|
1146
|
-
if (!gate || !assertion) {
|
|
1147
|
-
return '';
|
|
1148
|
-
}
|
|
1149
|
-
var proofPlan = gate.proof_plan;
|
|
1150
|
-
var proofContract = proofPlan.business_proof_contract;
|
|
1151
|
-
return hashResolveIOSupportV5Evidence({
|
|
1152
|
-
issueClass: gate.issue_class,
|
|
1153
|
-
proofPlan: {
|
|
1154
|
-
before: proofPlan.before,
|
|
1155
|
-
action: proofPlan.action,
|
|
1156
|
-
after: proofPlan.after,
|
|
1157
|
-
businessAssertion: proofPlan.business_assertion,
|
|
1158
|
-
dataAssertion: proofPlan.data_assertion,
|
|
1159
|
-
contractAction: proofContract === null || proofContract === void 0 ? void 0 : proofContract.action_under_test,
|
|
1160
|
-
contractExpected: proofContract === null || proofContract === void 0 ? void 0 : proofContract.expected_business_state_change,
|
|
1161
|
-
contractAssertion: proofContract === null || proofContract === void 0 ? void 0 : proofContract.data_or_dom_assertion
|
|
1162
|
-
},
|
|
1163
|
-
assertion: {
|
|
1164
|
-
assertion: assertion.assertion,
|
|
1165
|
-
status: assertion.status,
|
|
1166
|
-
workflow: assertion.workflow,
|
|
1167
|
-
route: assertion.route,
|
|
1168
|
-
before: assertion.before,
|
|
1169
|
-
action: assertion.action,
|
|
1170
|
-
expected: assertion.expected,
|
|
1171
|
-
after: assertion.after,
|
|
1172
|
-
observed: assertion.observed,
|
|
1173
|
-
dataProof: assertion.dataProof,
|
|
1174
|
-
mongoDelta: assertion.mongoDelta
|
|
1175
|
-
},
|
|
1176
|
-
artifacts: cleanList(((_a = assertion.artifactPaths) === null || _a === void 0 ? void 0 : _a.length) ? assertion.artifactPaths : artifactPaths, 80, 500).sort()
|
|
1177
|
-
});
|
|
1178
|
-
}
|
|
1179
|
-
function defaultSupportBusinessProofReadinessFields(values) {
|
|
1180
|
-
if (values === void 0) { values = {}; }
|
|
1181
|
-
var artifactPaths = cleanList(values.artifactPaths, 80, 500);
|
|
1182
|
-
return {
|
|
1183
|
-
artifactPaths: artifactPaths,
|
|
1184
|
-
proofFingerprint: cleanText(values.proofFingerprint, 160),
|
|
1185
|
-
artifactFingerprint: cleanText(values.artifactFingerprint, 160) || supportBusinessProofArtifactFingerprint(artifactPaths),
|
|
1186
|
-
proofFreshness: values.proofFreshness || (artifactPaths.length ? 'unknown' : 'missing')
|
|
1187
|
-
};
|
|
1188
|
-
}
|
|
1189
|
-
function evaluateResolveIOSupportBusinessProofReadiness(input) {
|
|
1190
|
-
if (input === void 0) { input = {}; }
|
|
1191
|
-
var diagnosisValidation = validateResolveIOSupportDiagnosisGate(input.diagnosisGate);
|
|
1192
|
-
var gate = diagnosisValidation.normalized;
|
|
1193
|
-
var requiredEvidence = [
|
|
1194
|
-
'valid SupportDiagnosisGate proof_plan',
|
|
1195
|
-
'AIQaBusinessAssertion status=pass',
|
|
1196
|
-
'business assertion maps to diagnosis proof_plan/business_proof_contract',
|
|
1197
|
-
'artifact path for browser/data proof',
|
|
1198
|
-
'DOM/data proof or Mongo delta for the expected business state change'
|
|
1199
|
-
];
|
|
1200
|
-
if (!diagnosisValidation.valid || !gate) {
|
|
1201
|
-
return __assign({ ready: false, status: 'blocked', reason: 'support_business_proof_waiting_on_valid_diagnosis', blockers: diagnosisValidation.blockers.length ? diagnosisValidation.blockers : ['Valid SupportDiagnosisGate is required before business proof can accept the ticket.'], requiredEvidence: requiredEvidence }, defaultSupportBusinessProofReadinessFields());
|
|
1202
|
-
}
|
|
1203
|
-
var assertions = normalizeSupportBusinessProofAssertions(input);
|
|
1204
|
-
if (!assertions.length) {
|
|
1205
|
-
return __assign({ ready: false, status: 'missing', reason: 'support_business_proof_missing_aiqa_business_assertion', blockers: ['No AIQaBusinessAssertion was recorded for the diagnosis proof_plan.'], requiredEvidence: requiredEvidence }, defaultSupportBusinessProofReadinessFields());
|
|
1206
|
-
}
|
|
1207
|
-
var artifactPaths = Array.from(new Set(assertions.flatMap(function (assertion) { return assertion.artifactPaths || []; })));
|
|
1208
|
-
var artifactFingerprint = supportBusinessProofArtifactFingerprint(artifactPaths);
|
|
1209
|
-
var failed = assertions.find(function (assertion) { return supportBusinessAssertionFailed(assertion.status); });
|
|
1210
|
-
if (failed) {
|
|
1211
|
-
var failedFingerprint = supportBusinessProofFingerprint(gate, failed, artifactPaths);
|
|
1212
|
-
return __assign(__assign({ ready: false, status: 'failed', reason: 'support_business_proof_assertion_failed', blockers: [failed.message || failed.observed || failed.assertion || 'Business assertion failed.'], requiredEvidence: requiredEvidence }, defaultSupportBusinessProofReadinessFields({
|
|
1213
|
-
artifactPaths: artifactPaths,
|
|
1214
|
-
proofFingerprint: failedFingerprint,
|
|
1215
|
-
artifactFingerprint: artifactFingerprint,
|
|
1216
|
-
proofFreshness: 'fresh'
|
|
1217
|
-
})), { matchedAssertion: failed });
|
|
1218
|
-
}
|
|
1219
|
-
var routeOnly = assertions.find(function (assertion) { return assertion.routeOnly || assertion.acceptanceBlocked || supportBusinessAssertionRouteOnly(assertion.status) || proofPlanLooksRouteOnly({
|
|
1220
|
-
before: assertion.before || '',
|
|
1221
|
-
action: assertion.action || '',
|
|
1222
|
-
after: assertion.after || assertion.expected || '',
|
|
1223
|
-
business_assertion: assertion.assertion || assertion.message || '',
|
|
1224
|
-
data_assertion: assertion.dataProof || '',
|
|
1225
|
-
artifact_expectation: assertion.artifactPaths.join(', ')
|
|
1226
|
-
}); });
|
|
1227
|
-
if (routeOnly) {
|
|
1228
|
-
var routeOnlyFingerprint = supportBusinessProofFingerprint(gate, routeOnly, artifactPaths);
|
|
1229
|
-
return __assign(__assign({ ready: false, status: 'route_only', reason: 'support_business_proof_route_only_or_acceptance_blocked', blockers: ['Route probe, shell/screenshot, or acceptance_blocked proof cannot accept the ticket. Run the issue-class business assertion.'], requiredEvidence: requiredEvidence }, defaultSupportBusinessProofReadinessFields({
|
|
1230
|
-
artifactPaths: artifactPaths,
|
|
1231
|
-
proofFingerprint: routeOnlyFingerprint,
|
|
1232
|
-
artifactFingerprint: artifactFingerprint,
|
|
1233
|
-
proofFreshness: 'fresh'
|
|
1234
|
-
})), { matchedAssertion: routeOnly });
|
|
1235
|
-
}
|
|
1236
|
-
var passedAssertions = assertions.filter(function (assertion) { return supportBusinessAssertionPassed(assertion.status); });
|
|
1237
|
-
var matched = passedAssertions.find(function (assertion) { return supportBusinessProofAssertionMatchesContract(assertion, gate); });
|
|
1238
|
-
if (!matched) {
|
|
1239
|
-
return __assign({ ready: false, status: 'weak', reason: 'support_business_proof_does_not_match_diagnosis_contract', blockers: ['A passed assertion exists, but it does not map to the diagnosis proof_plan/business_proof_contract.'], requiredEvidence: requiredEvidence }, defaultSupportBusinessProofReadinessFields({ artifactPaths: artifactPaths, artifactFingerprint: artifactFingerprint }));
|
|
1240
|
-
}
|
|
1241
|
-
var proofArtifactPaths = matched.artifactPaths.length ? matched.artifactPaths : artifactPaths;
|
|
1242
|
-
var proofFingerprint = supportBusinessProofFingerprint(gate, matched, proofArtifactPaths);
|
|
1243
|
-
var matchedArtifactFingerprint = supportBusinessProofArtifactFingerprint(proofArtifactPaths);
|
|
1244
|
-
var previousProofFingerprint = cleanText(input.previousProofFingerprint, 160);
|
|
1245
|
-
var previousArtifactFingerprint = cleanText(input.previousArtifactFingerprint, 160);
|
|
1246
|
-
var sameProofAsPrevious = !!previousProofFingerprint && previousProofFingerprint === proofFingerprint;
|
|
1247
|
-
var sameArtifactAsPrevious = !!previousArtifactFingerprint && previousArtifactFingerprint === matchedArtifactFingerprint;
|
|
1248
|
-
if (sameProofAsPrevious || sameArtifactAsPrevious) {
|
|
1249
|
-
return __assign(__assign({ ready: false, status: 'stale', reason: sameProofAsPrevious
|
|
1250
|
-
? 'support_business_proof_same_fingerprint_as_previous'
|
|
1251
|
-
: 'support_business_proof_same_artifact_fingerprint_as_previous', blockers: ['Business proof did not produce a new proof/artifact fingerprint for this run. Rerun the issue-specific assertion and record fresh artifact proof.'], requiredEvidence: requiredEvidence }, defaultSupportBusinessProofReadinessFields({
|
|
1252
|
-
artifactPaths: proofArtifactPaths,
|
|
1253
|
-
proofFingerprint: proofFingerprint,
|
|
1254
|
-
artifactFingerprint: matchedArtifactFingerprint,
|
|
1255
|
-
proofFreshness: sameProofAsPrevious ? 'same_as_previous' : 'stale_artifact'
|
|
1256
|
-
})), { matchedAssertion: matched });
|
|
1257
|
-
}
|
|
1258
|
-
if (!matched.artifactPaths.length && !artifactPaths.length) {
|
|
1259
|
-
return __assign(__assign({ ready: false, status: 'weak', reason: 'support_business_proof_missing_artifact_path', blockers: ['Business proof must include at least one artifact path.'], requiredEvidence: requiredEvidence }, defaultSupportBusinessProofReadinessFields({
|
|
1260
|
-
artifactPaths: artifactPaths,
|
|
1261
|
-
proofFingerprint: proofFingerprint,
|
|
1262
|
-
artifactFingerprint: matchedArtifactFingerprint
|
|
1263
|
-
})), { matchedAssertion: matched });
|
|
1264
|
-
}
|
|
1265
|
-
var hasDataOrDomProof = !!cleanText(matched.dataProof, 50)
|
|
1266
|
-
|| Object.keys(cleanObject(matched.mongoDelta)).length > 0
|
|
1267
|
-
|| !!cleanText(matched.observed, 80)
|
|
1268
|
-
|| !!cleanText(matched.after, 80);
|
|
1269
|
-
if (!hasDataOrDomProof) {
|
|
1270
|
-
return __assign(__assign({ ready: false, status: 'weak', reason: 'support_business_proof_missing_dom_or_data_proof', blockers: ['Business proof must include DOM/data proof, observed result, after-state, or Mongo delta.'], requiredEvidence: requiredEvidence }, defaultSupportBusinessProofReadinessFields({
|
|
1271
|
-
artifactPaths: proofArtifactPaths,
|
|
1272
|
-
proofFingerprint: proofFingerprint,
|
|
1273
|
-
artifactFingerprint: matchedArtifactFingerprint
|
|
1274
|
-
})), { matchedAssertion: matched });
|
|
1275
|
-
}
|
|
1276
|
-
return __assign(__assign({ ready: true, status: 'passed', reason: 'support_business_proof_ready', blockers: [], requiredEvidence: requiredEvidence }, defaultSupportBusinessProofReadinessFields({
|
|
1277
|
-
artifactPaths: proofArtifactPaths,
|
|
1278
|
-
proofFingerprint: proofFingerprint,
|
|
1279
|
-
artifactFingerprint: matchedArtifactFingerprint,
|
|
1280
|
-
proofFreshness: 'fresh'
|
|
1281
|
-
})), { matchedAssertion: matched });
|
|
1282
|
-
}
|
|
1283
|
-
function buildSupportClarificationQuestion(gate, blockers) {
|
|
1284
|
-
if ((gate === null || gate === void 0 ? void 0 : gate.issue_case.reproduction_status) === 'blocked' && gate.issue_case.reproduction_blocker) {
|
|
1285
|
-
return "Can you provide the missing detail needed to reproduce this issue: ".concat(gate.issue_case.reproduction_blocker, "?");
|
|
1286
|
-
}
|
|
1287
|
-
if (blockers.some(function (blocker) { return /expected_result/.test(blocker); })) {
|
|
1288
|
-
return 'What result did you expect to see in this workflow?';
|
|
1289
|
-
}
|
|
1290
|
-
if (blockers.some(function (blocker) { return /observed_result/.test(blocker); })) {
|
|
1291
|
-
return 'What exact result are you seeing instead, including the affected record or screen if possible?';
|
|
1292
|
-
}
|
|
1293
|
-
if (blockers.some(function (blocker) { return /account_customer_context/.test(blocker); })) {
|
|
1294
|
-
return 'Which customer/account/user context should we use to reproduce this issue?';
|
|
1295
|
-
}
|
|
1296
|
-
return 'Can you send one concrete example record, screen, or action path where this issue still occurs?';
|
|
1297
|
-
}
|
|
1298
|
-
function buildResolveIOSupportHumanReviewPacket(input) {
|
|
1299
|
-
return {
|
|
1300
|
-
reviewType: input.reviewType,
|
|
1301
|
-
title: cleanText(input.title, 200) || 'Review Support Runner Action',
|
|
1302
|
-
summary: cleanText(input.summary || input.reason, 1000),
|
|
1303
|
-
primaryAction: cleanText(input.primaryAction, 160) || 'review_support_runner_action',
|
|
1304
|
-
question: cleanText(input.question, 1000) || undefined,
|
|
1305
|
-
customerFacingDraftAllowed: input.customerFacingDraftAllowed === true,
|
|
1306
|
-
customerSendAllowed: false,
|
|
1307
|
-
requiresHumanApproval: input.requiresHumanApproval !== false,
|
|
1308
|
-
safety: input.safety || 'internal_hold',
|
|
1309
|
-
reason: cleanText(input.reason, 500),
|
|
1310
|
-
blockers: cleanList(input.blockers, 20, 500),
|
|
1311
|
-
requiredEvidence: cleanList(input.requiredEvidence, 30, 500),
|
|
1312
|
-
evidenceRefs: cleanList(input.evidenceRefs, 40, 500),
|
|
1313
|
-
nextCommands: cleanList(input.nextCommands, 20, 200),
|
|
1314
|
-
forbiddenActions: Array.from(new Set(__spreadArray([
|
|
1315
|
-
'Do not send customer email without explicit human approval.'
|
|
1316
|
-
], __read(cleanList(input.forbiddenActions, 20, 500)), false))),
|
|
1317
|
-
costRisk: input.costRisk || 'small_model_or_qa',
|
|
1318
|
-
createdAt: isoNow(input.now)
|
|
1319
|
-
};
|
|
1320
|
-
}
|
|
1321
|
-
function supportAutonomousReviewTypeForAction(action) {
|
|
1322
|
-
switch (action) {
|
|
1323
|
-
case 'run_diagnosis_gate':
|
|
1324
|
-
return 'diagnosis_gate';
|
|
1325
|
-
case 'ask_customer_clarification':
|
|
1326
|
-
return 'customer_clarification';
|
|
1327
|
-
case 'run_owner_scoped_repair':
|
|
1328
|
-
case 'revise_diagnosis_scope':
|
|
1329
|
-
return 'owner_scoped_repair';
|
|
1330
|
-
case 'run_business_proof_qa':
|
|
1331
|
-
return 'business_proof_qa';
|
|
1332
|
-
case 'repair_release_hotfix_first':
|
|
1333
|
-
case 'ready_for_release_gate':
|
|
1334
|
-
return 'release_hotfix';
|
|
1335
|
-
case 'draft_customer_reply':
|
|
1336
|
-
return 'customer_resolution_reply';
|
|
1337
|
-
case 'collect_new_evidence':
|
|
1338
|
-
return 'new_evidence';
|
|
1339
|
-
case 'repair_infra_only':
|
|
1340
|
-
case 'park_manual':
|
|
1341
|
-
default:
|
|
1342
|
-
return 'internal_hold';
|
|
1343
|
-
}
|
|
1344
|
-
}
|
|
1345
|
-
function decideResolveIOSupportCustomerReplyPolicy(input) {
|
|
1346
|
-
var _a, _b, _c;
|
|
1347
|
-
if (input === void 0) { input = {}; }
|
|
1348
|
-
var diagnosisValidation = validateResolveIOSupportDiagnosisGate(input.diagnosisGate);
|
|
1349
|
-
var gate = diagnosisValidation.normalized;
|
|
1350
|
-
var confidenceLevel = normalizeSupportConfidenceLevel(input.confidence);
|
|
1351
|
-
var shouldBlockConfidence = ((_a = input.confidence) === null || _a === void 0 ? void 0 : _a.shouldBlockPr) === true
|
|
1352
|
-
|| ((_b = input.confidence) === null || _b === void 0 ? void 0 : _b.should_block_pr) === true
|
|
1353
|
-
|| ((_c = input.confidence) === null || _c === void 0 ? void 0 : _c.blocked) === true;
|
|
1354
|
-
var businessProofReadiness = evaluateResolveIOSupportBusinessProofReadiness({
|
|
1355
|
-
diagnosisGate: input.diagnosisGate,
|
|
1356
|
-
outcomeLabel: input.outcomeLabel,
|
|
1357
|
-
businessAssertionStatus: input.businessAssertionStatus,
|
|
1358
|
-
businessAssertions: input.businessAssertions,
|
|
1359
|
-
businessProofArtifacts: input.businessProofArtifacts,
|
|
1360
|
-
previousProofFingerprint: input.previousProofFingerprint,
|
|
1361
|
-
previousArtifactFingerprint: input.previousArtifactFingerprint
|
|
1362
|
-
});
|
|
1363
|
-
var artifactCount = businessProofReadiness.artifactPaths.length;
|
|
1364
|
-
var unresolvedBlockers = cleanList(input.unresolvedBlockers, 20, 500);
|
|
1365
|
-
var releaseBlocked = supportReleaseLooksBlocked(input.releaseStatus);
|
|
1366
|
-
var requiredEvidence = [
|
|
1367
|
-
'valid SupportDiagnosisGate',
|
|
1368
|
-
'high confidence with shouldBlockPr=false',
|
|
1369
|
-
'accepted outcome or passed business assertion',
|
|
1370
|
-
'business proof contract and artifact evidence',
|
|
1371
|
-
'no unresolved blocker or release blocker'
|
|
1372
|
-
];
|
|
1373
|
-
if (!diagnosisValidation.valid) {
|
|
1374
|
-
var canAskCustomer = (gate === null || gate === void 0 ? void 0 : gate.issue_case.reproduction_status) === 'blocked'
|
|
1375
|
-
|| diagnosisValidation.blockers.some(function (blocker) { return /expected_result|observed_result|account_customer_context/.test(blocker); });
|
|
1376
|
-
if (canAskCustomer) {
|
|
1377
|
-
var clarificationQuestion = buildSupportClarificationQuestion(gate, diagnosisValidation.blockers);
|
|
1378
|
-
return {
|
|
1379
|
-
action: 'ask_clarification',
|
|
1380
|
-
canDraftCustomerReply: true,
|
|
1381
|
-
canSendCustomerReply: false,
|
|
1382
|
-
confidenceLevel: confidenceLevel,
|
|
1383
|
-
safety: 'needs_clarification',
|
|
1384
|
-
reason: 'support_reply_waiting_on_customer_reproduction_detail',
|
|
1385
|
-
requiredEvidence: requiredEvidence,
|
|
1386
|
-
clarificationQuestion: clarificationQuestion,
|
|
1387
|
-
humanReviewPacket: buildResolveIOSupportHumanReviewPacket({
|
|
1388
|
-
reviewType: 'customer_clarification',
|
|
1389
|
-
title: 'Review Customer Clarification',
|
|
1390
|
-
summary: 'The runner needs one customer detail before it can reproduce or continue safely.',
|
|
1391
|
-
primaryAction: 'review_customer_clarification',
|
|
1392
|
-
question: clarificationQuestion,
|
|
1393
|
-
customerFacingDraftAllowed: true,
|
|
1394
|
-
safety: 'needs_clarification',
|
|
1395
|
-
reason: 'support_reply_waiting_on_customer_reproduction_detail',
|
|
1396
|
-
blockers: diagnosisValidation.blockers,
|
|
1397
|
-
requiredEvidence: requiredEvidence,
|
|
1398
|
-
nextCommands: ['edit_clarification_question', 'send_after_human_review', 'park_ticket_until_customer_reply'],
|
|
1399
|
-
forbiddenActions: ['Do not run repair from a guessed reproduction path.'],
|
|
1400
|
-
costRisk: 'release_or_customer_send'
|
|
1401
|
-
})
|
|
1402
|
-
};
|
|
1403
|
-
}
|
|
1404
|
-
return {
|
|
1405
|
-
action: 'hold_internal',
|
|
1406
|
-
canDraftCustomerReply: false,
|
|
1407
|
-
canSendCustomerReply: false,
|
|
1408
|
-
confidenceLevel: confidenceLevel,
|
|
1409
|
-
safety: 'internal_hold',
|
|
1410
|
-
reason: 'support_reply_blocked_until_diagnosis_gate_validates',
|
|
1411
|
-
requiredEvidence: requiredEvidence,
|
|
1412
|
-
humanReviewPacket: buildResolveIOSupportHumanReviewPacket({
|
|
1413
|
-
reviewType: 'internal_hold',
|
|
1414
|
-
title: 'Complete Diagnosis Gate',
|
|
1415
|
-
summary: 'Customer reply is blocked until the diagnosis gate validates.',
|
|
1416
|
-
primaryAction: 'run_support_v5_read_only_diagnosis_gate',
|
|
1417
|
-
safety: 'internal_hold',
|
|
1418
|
-
reason: 'support_reply_blocked_until_diagnosis_gate_validates',
|
|
1419
|
-
blockers: diagnosisValidation.blockers,
|
|
1420
|
-
requiredEvidence: requiredEvidence,
|
|
1421
|
-
nextCommands: ['retrieve_similar_tickets_and_commits', 'run_reproduction_or_classification_probe', 'write_support_diagnosis_gate_json'],
|
|
1422
|
-
forbiddenActions: ['Do not draft a resolution reply before root-cause diagnosis validates.'],
|
|
1423
|
-
costRisk: 'expensive_model'
|
|
1424
|
-
})
|
|
1425
|
-
};
|
|
1426
|
-
}
|
|
1427
|
-
if (shouldBlockConfidence || confidenceLevel !== 'high') {
|
|
1428
|
-
return {
|
|
1429
|
-
action: 'hold_internal',
|
|
1430
|
-
canDraftCustomerReply: false,
|
|
1431
|
-
canSendCustomerReply: false,
|
|
1432
|
-
confidenceLevel: confidenceLevel,
|
|
1433
|
-
safety: 'internal_hold',
|
|
1434
|
-
reason: shouldBlockConfidence ? 'support_reply_blocked_by_confidence_gate' : 'support_reply_requires_high_confidence',
|
|
1435
|
-
requiredEvidence: requiredEvidence,
|
|
1436
|
-
humanReviewPacket: buildResolveIOSupportHumanReviewPacket({
|
|
1437
|
-
reviewType: 'internal_hold',
|
|
1438
|
-
title: 'Review Confidence Gate',
|
|
1439
|
-
summary: 'Customer reply is blocked until confidence is high and the confidence gate is not blocking.',
|
|
1440
|
-
primaryAction: 'review_support_confidence_evidence',
|
|
1441
|
-
safety: 'internal_hold',
|
|
1442
|
-
reason: shouldBlockConfidence ? 'support_reply_blocked_by_confidence_gate' : 'support_reply_requires_high_confidence',
|
|
1443
|
-
requiredEvidence: requiredEvidence,
|
|
1444
|
-
nextCommands: ['inspect_confidence_basis', 'collect_missing_business_or_release_evidence'],
|
|
1445
|
-
forbiddenActions: ['Do not draft a customer resolution from medium or low confidence.'],
|
|
1446
|
-
costRisk: 'free_or_deterministic'
|
|
1447
|
-
})
|
|
1448
|
-
};
|
|
1449
|
-
}
|
|
1450
|
-
if (unresolvedBlockers.length) {
|
|
1451
|
-
return {
|
|
1452
|
-
action: 'hold_internal',
|
|
1453
|
-
canDraftCustomerReply: false,
|
|
1454
|
-
canSendCustomerReply: false,
|
|
1455
|
-
confidenceLevel: confidenceLevel,
|
|
1456
|
-
safety: 'internal_hold',
|
|
1457
|
-
reason: 'support_reply_blocked_by_unresolved_runner_blocker',
|
|
1458
|
-
requiredEvidence: requiredEvidence,
|
|
1459
|
-
humanReviewPacket: buildResolveIOSupportHumanReviewPacket({
|
|
1460
|
-
reviewType: 'internal_hold',
|
|
1461
|
-
title: 'Resolve Runner Blocker',
|
|
1462
|
-
summary: 'Customer reply is blocked by unresolved runner blockers.',
|
|
1463
|
-
primaryAction: 'review_support_runner_blocker',
|
|
1464
|
-
safety: 'internal_hold',
|
|
1465
|
-
reason: 'support_reply_blocked_by_unresolved_runner_blocker',
|
|
1466
|
-
blockers: unresolvedBlockers,
|
|
1467
|
-
requiredEvidence: requiredEvidence,
|
|
1468
|
-
nextCommands: ['classify_blocker', 'collect_new_evidence_or_repair_smallest_gate'],
|
|
1469
|
-
forbiddenActions: ['Do not send customer status as resolved while blockers remain.'],
|
|
1470
|
-
costRisk: 'small_model_or_qa'
|
|
1471
|
-
})
|
|
1472
|
-
};
|
|
1473
|
-
}
|
|
1474
|
-
if (releaseBlocked) {
|
|
1475
|
-
return {
|
|
1476
|
-
action: 'hold_internal',
|
|
1477
|
-
canDraftCustomerReply: false,
|
|
1478
|
-
canSendCustomerReply: false,
|
|
1479
|
-
confidenceLevel: confidenceLevel,
|
|
1480
|
-
safety: 'internal_hold',
|
|
1481
|
-
reason: 'support_reply_blocked_until_release_or_hotfix_gate_finishes',
|
|
1482
|
-
requiredEvidence: requiredEvidence,
|
|
1483
|
-
humanReviewPacket: buildResolveIOSupportHumanReviewPacket({
|
|
1484
|
-
reviewType: 'release_hotfix',
|
|
1485
|
-
title: 'Finish Release Or Hotfix Gate',
|
|
1486
|
-
summary: 'Business proof exists, but the customer reply is blocked until release or hotfix evidence is complete.',
|
|
1487
|
-
primaryAction: 'repair_release_hotfix_first',
|
|
1488
|
-
safety: 'internal_hold',
|
|
1489
|
-
reason: 'support_reply_blocked_until_release_or_hotfix_gate_finishes',
|
|
1490
|
-
blockers: [input.releaseStatus],
|
|
1491
|
-
requiredEvidence: requiredEvidence,
|
|
1492
|
-
nextCommands: ['record_hotfix_evidence', 'commit_and_push_hotfix_to_github', 'rerun_release_gate_once'],
|
|
1493
|
-
forbiddenActions: ['Do not tell the customer the fix is live before release evidence passes.'],
|
|
1494
|
-
costRisk: 'release_or_customer_send'
|
|
1495
|
-
})
|
|
1496
|
-
};
|
|
1497
|
-
}
|
|
1498
|
-
if (!businessProofReadiness.ready) {
|
|
1499
|
-
var replyReason = businessProofReadiness.reason === 'support_business_proof_route_only_or_acceptance_blocked'
|
|
1500
|
-
? 'support_reply_rejects_route_only_business_proof'
|
|
1501
|
-
: 'support_reply_requires_business_assertion_pass';
|
|
1502
|
-
var proofRequiredEvidence = Array.from(new Set(__spreadArray(__spreadArray([], __read(requiredEvidence), false), __read(businessProofReadiness.requiredEvidence), false)));
|
|
1503
|
-
return {
|
|
1504
|
-
action: 'hold_internal',
|
|
1505
|
-
canDraftCustomerReply: false,
|
|
1506
|
-
canSendCustomerReply: false,
|
|
1507
|
-
confidenceLevel: confidenceLevel,
|
|
1508
|
-
safety: 'internal_hold',
|
|
1509
|
-
reason: replyReason,
|
|
1510
|
-
requiredEvidence: proofRequiredEvidence,
|
|
1511
|
-
humanReviewPacket: buildResolveIOSupportHumanReviewPacket({
|
|
1512
|
-
reviewType: 'business_proof_qa',
|
|
1513
|
-
title: 'Run Business Proof QA',
|
|
1514
|
-
summary: 'Customer reply is blocked until the issue-specific before/action/after assertion passes.',
|
|
1515
|
-
primaryAction: 'run_support_v5_business_proof_qa_row',
|
|
1516
|
-
safety: 'internal_hold',
|
|
1517
|
-
reason: replyReason,
|
|
1518
|
-
blockers: businessProofReadiness.blockers,
|
|
1519
|
-
requiredEvidence: proofRequiredEvidence,
|
|
1520
|
-
evidenceRefs: businessProofReadiness.artifactPaths,
|
|
1521
|
-
nextCommands: ['execute_issue_class_probe', 'record_before_action_after_artifacts', 'write_aiqa_business_assertion'],
|
|
1522
|
-
forbiddenActions: ['Route probe pass remains route evidence only.'],
|
|
1523
|
-
costRisk: 'small_model_or_qa'
|
|
1524
|
-
})
|
|
1525
|
-
};
|
|
1526
|
-
}
|
|
1527
|
-
if (!(gate === null || gate === void 0 ? void 0 : gate.proof_plan.business_proof_contract) || artifactCount < 1) {
|
|
1528
|
-
return {
|
|
1529
|
-
action: 'hold_internal',
|
|
1530
|
-
canDraftCustomerReply: false,
|
|
1531
|
-
canSendCustomerReply: false,
|
|
1532
|
-
confidenceLevel: confidenceLevel,
|
|
1533
|
-
safety: 'internal_hold',
|
|
1534
|
-
reason: 'support_reply_requires_business_proof_contract_artifact',
|
|
1535
|
-
requiredEvidence: requiredEvidence,
|
|
1536
|
-
humanReviewPacket: buildResolveIOSupportHumanReviewPacket({
|
|
1537
|
-
reviewType: 'business_proof_qa',
|
|
1538
|
-
title: 'Attach Business Proof Artifact',
|
|
1539
|
-
summary: 'Customer reply is blocked until the business proof contract and artifact are attached.',
|
|
1540
|
-
primaryAction: 'record_business_proof_artifact',
|
|
1541
|
-
safety: 'internal_hold',
|
|
1542
|
-
reason: 'support_reply_requires_business_proof_contract_artifact',
|
|
1543
|
-
requiredEvidence: requiredEvidence,
|
|
1544
|
-
evidenceRefs: businessProofReadiness.artifactPaths,
|
|
1545
|
-
nextCommands: ['attach_business_proof_contract', 'attach_artifact_path', 'rerun_reply_policy'],
|
|
1546
|
-
forbiddenActions: ['Do not draft a resolution reply without a proof artifact.'],
|
|
1547
|
-
costRisk: 'free_or_deterministic'
|
|
1548
|
-
})
|
|
1549
|
-
};
|
|
1550
|
-
}
|
|
1551
|
-
return {
|
|
1552
|
-
action: 'draft_resolution_reply',
|
|
1553
|
-
canDraftCustomerReply: true,
|
|
1554
|
-
canSendCustomerReply: false,
|
|
1555
|
-
confidenceLevel: confidenceLevel,
|
|
1556
|
-
safety: 'safe_to_draft',
|
|
1557
|
-
reason: 'support_reply_resolution_draft_allowed_after_business_proof',
|
|
1558
|
-
requiredEvidence: requiredEvidence,
|
|
1559
|
-
humanReviewPacket: buildResolveIOSupportHumanReviewPacket({
|
|
1560
|
-
reviewType: 'customer_resolution_reply',
|
|
1561
|
-
title: 'Review Customer Resolution Reply',
|
|
1562
|
-
summary: "Business proof is ready for ".concat(gate.issue_class, "; draft a customer-facing resolution for human review."),
|
|
1563
|
-
primaryAction: 'review_customer_reply',
|
|
1564
|
-
customerFacingDraftAllowed: true,
|
|
1565
|
-
safety: 'safe_to_draft',
|
|
1566
|
-
reason: 'support_reply_resolution_draft_allowed_after_business_proof',
|
|
1567
|
-
requiredEvidence: requiredEvidence,
|
|
1568
|
-
evidenceRefs: businessProofReadiness.artifactPaths,
|
|
1569
|
-
nextCommands: ['summarize_business_proof', 'draft_customer_reply_for_human_review'],
|
|
1570
|
-
forbiddenActions: ['Draft only; do not send automatically.'],
|
|
1571
|
-
costRisk: 'release_or_customer_send'
|
|
1572
|
-
}),
|
|
1573
|
-
draftBasis: {
|
|
1574
|
-
issueClass: gate.issue_class,
|
|
1575
|
-
businessProof: gate.proof_plan.business_proof_contract.expected_business_state_change,
|
|
1576
|
-
artifactCount: artifactCount
|
|
1577
|
-
}
|
|
1578
|
-
};
|
|
1579
|
-
}
|
|
1580
|
-
function buildResolveIOSupportIssueClassProbes(value) {
|
|
1581
|
-
var validation = validateResolveIOSupportDiagnosisGate(value);
|
|
1582
|
-
var gate = validation.normalized || normalizeResolveIOSupportDiagnosisGate(value);
|
|
1583
|
-
if (!gate) {
|
|
1584
|
-
return [];
|
|
1585
|
-
}
|
|
1586
|
-
var route = gate.proof_plan.route || gate.issue_case.route_module;
|
|
1587
|
-
var proofContract = gate.proof_plan.business_proof_contract;
|
|
1588
|
-
var proof = (proofContract === null || proofContract === void 0 ? void 0 : proofContract.expected_business_state_change) || gate.proof_plan.business_assertion;
|
|
1589
|
-
var assertion = (proofContract === null || proofContract === void 0 ? void 0 : proofContract.data_or_dom_assertion) || gate.proof_plan.data_assertion || gate.proof_plan.after;
|
|
1590
|
-
var contractArtifacts = cleanList(proofContract === null || proofContract === void 0 ? void 0 : proofContract.proof_artifacts, 8, 160);
|
|
1591
|
-
var common = {
|
|
1592
|
-
issue_class: gate.issue_class,
|
|
1593
|
-
probe_type: 'issue_class_probe',
|
|
1594
|
-
route: route,
|
|
1595
|
-
state_transition: {
|
|
1596
|
-
before: gate.proof_plan.before || gate.proof_plan.before_state_unavailable_reason || (proofContract === null || proofContract === void 0 ? void 0 : proofContract.setup_state) || '',
|
|
1597
|
-
action: gate.proof_plan.action || (proofContract === null || proofContract === void 0 ? void 0 : proofContract.action_under_test) || '',
|
|
1598
|
-
after: gate.proof_plan.after || (proofContract === null || proofContract === void 0 ? void 0 : proofContract.expected_business_state_change) || '',
|
|
1599
|
-
assertion: assertion || gate.proof_plan.business_assertion || ''
|
|
1600
|
-
},
|
|
1601
|
-
acceptance_gate: 'aiqa_business_assertion',
|
|
1602
|
-
blocks_acceptance_without_business_assertion: true
|
|
1603
|
-
};
|
|
1604
|
-
var map = {
|
|
1605
|
-
no_op_submit: {
|
|
1606
|
-
action: "Submit the customer action on ".concat(route || 'the affected screen', " and assert a persisted state change or explicit validation message."),
|
|
1607
|
-
expected: proof || 'Before/action/after proof shows the submit is no longer a no-op.',
|
|
1608
|
-
failureClass: 'business',
|
|
1609
|
-
requiredArtifacts: ['before form state', 'submit action trace', 'post-submit DOM/data proof', 'method/network result']
|
|
1610
|
-
},
|
|
1611
|
-
missing_wrong_data: {
|
|
1612
|
-
action: "Load the named record/list on ".concat(route || 'the affected route', " and compare visible data to the expected persisted source."),
|
|
1613
|
-
expected: proof || 'Visible data and persisted data match the customer expectation.',
|
|
1614
|
-
failureClass: 'business',
|
|
1615
|
-
requiredArtifacts: ['expected source record', 'visible DOM/data snapshot', 'persisted data comparison']
|
|
1616
|
-
},
|
|
1617
|
-
filter_query_mismatch: {
|
|
1618
|
-
action: 'Apply the reported filter/query inputs and assert the returned rows/counts match the expected dataset.',
|
|
1619
|
-
expected: proof || 'Filter/query output contains the correct included rows and excludes the wrong rows.',
|
|
1620
|
-
failureClass: 'business',
|
|
1621
|
-
requiredArtifacts: ['filter input trace', 'included/excluded row proof', 'query or publication result proof']
|
|
1622
|
-
},
|
|
1623
|
-
invoice_pdf_export: {
|
|
1624
|
-
action: 'Generate the invoice/PDF/export from the affected route and inspect the downloaded/generated artifact.',
|
|
1625
|
-
expected: proof || 'Generated artifact contains the expected customer-visible rows, totals, or fields.',
|
|
1626
|
-
failureClass: 'business',
|
|
1627
|
-
requiredArtifacts: ['export trigger trace', 'generated file artifact path', 'parsed artifact content proof']
|
|
1628
|
-
},
|
|
1629
|
-
upload_import: {
|
|
1630
|
-
action: 'Run the upload/import workflow with a representative file and assert parsed plus persisted results.',
|
|
1631
|
-
expected: proof || 'Import shows a success result and persisted rows/counts changed as expected.',
|
|
1632
|
-
failureClass: 'business',
|
|
1633
|
-
requiredArtifacts: ['input file fixture', 'import result message', 'persisted row/count delta']
|
|
1634
|
-
},
|
|
1635
|
-
route_auth_hydration: {
|
|
1636
|
-
action: 'Open the route as the affected user and assert authenticated hydration reaches the functional screen, not a shell.',
|
|
1637
|
-
expected: proof || 'Route hydrates with the required controls/data for the affected account.',
|
|
1638
|
-
failureClass: 'route',
|
|
1639
|
-
requiredArtifacts: ['auth context', 'hydrated DOM proof', 'console/network error log']
|
|
1640
|
-
},
|
|
1641
|
-
slow_query_performance: {
|
|
1642
|
-
action: 'Run the reported query/workflow with timing/log evidence before and after the fix.',
|
|
1643
|
-
expected: proof || 'Performance evidence shows the slow path improved without changing results.',
|
|
1644
|
-
failureClass: 'business',
|
|
1645
|
-
requiredArtifacts: ['before timing', 'after timing', 'result equivalence proof', 'query/log trace']
|
|
1646
|
-
}
|
|
1647
|
-
};
|
|
1648
|
-
var selected = map[gate.issue_class];
|
|
1649
|
-
var requiredArtifacts = Array.from(new Set(__spreadArray(__spreadArray([], __read(contractArtifacts), false), __read(selected.requiredArtifacts), false)));
|
|
1650
|
-
return [__assign(__assign({}, common), { failure_class: selected.failureClass, objective: "Issue-class probe for ".concat(gate.issue_class, ": ").concat(gate.issue_case.customer_complaint), action: proofContract
|
|
1651
|
-
? "".concat(proofContract.action_under_test, " ").concat(selected.action)
|
|
1652
|
-
: selected.action, expected_evidence: "".concat(selected.expected).concat(assertion ? " Assertion: ".concat(assertion, ".") : '').concat(requiredArtifacts.length ? " Required artifacts: ".concat(requiredArtifacts.join(', '), ".") : '').trim(), expected_business_proof: proof || gate.proof_plan.business_assertion, required_artifacts: requiredArtifacts })];
|
|
1653
|
-
}
|
|
1654
|
-
function hashResolveIOSupportV5Evidence(value) {
|
|
1655
|
-
var raw = typeof value === 'string' ? value : JSON.stringify(value || {});
|
|
1656
|
-
var normalized = cleanText(raw, 8000)
|
|
1657
|
-
.toLowerCase()
|
|
1658
|
-
.replace(/[a-f0-9]{16,}/g, '<id>')
|
|
1659
|
-
.replace(/\b\d{2,}\b/g, '<n>');
|
|
1660
|
-
var hash = 0;
|
|
1661
|
-
for (var index = 0; index < normalized.length; index += 1) {
|
|
1662
|
-
hash = ((hash << 5) - hash + normalized.charCodeAt(index)) | 0;
|
|
1663
|
-
}
|
|
1664
|
-
return "ev-".concat(Math.abs(hash).toString(36) || '0');
|
|
1665
|
-
}
|
|
1666
|
-
function decideResolveIOSupportV5RepeatedFailureStop(input) {
|
|
1667
|
-
var failureClass = cleanText(input.failureClass || 'unknown', 80).toLowerCase();
|
|
1668
|
-
var blockerFingerprint = fingerprintResolveIOSupportV5Blocker(input.blocker || '');
|
|
1669
|
-
var evidenceHash = cleanText(input.evidenceHash, 80) || hashResolveIOSupportV5Evidence(input.evidence || input.blocker || '');
|
|
1670
|
-
var limit = Math.max(1, Number(input.limit || 2) || 2);
|
|
1671
|
-
if (input.ignoreInfra !== false && /^(infra|compile)$/.test(failureClass)) {
|
|
1672
|
-
return {
|
|
1673
|
-
shouldStop: false,
|
|
1674
|
-
repeatedCount: 0,
|
|
1675
|
-
failureClass: failureClass,
|
|
1676
|
-
blockerFingerprint: blockerFingerprint,
|
|
1677
|
-
evidenceHash: evidenceHash,
|
|
1678
|
-
reason: 'support_v5_infra_failures_do_not_count_as_product_repair_loops'
|
|
1679
|
-
};
|
|
1680
|
-
}
|
|
1681
|
-
var latestRecord = (input.history || [])[(input.history || []).length - 1];
|
|
1682
|
-
var managerDecision = (0, ai_runner_manager_policy_1.decideResolveIOAIManagerPolicy)({
|
|
1683
|
-
history: (input.history || []).map(function (entry) { return ({
|
|
1684
|
-
outcome: entry.outcome,
|
|
1685
|
-
lane: entry.lane,
|
|
1686
|
-
stepType: entry.stepType,
|
|
1687
|
-
failureClass: entry.failureClass,
|
|
1688
|
-
blocker: entry.blocker || entry.summary,
|
|
1689
|
-
evidenceHash: entry.evidenceHash,
|
|
1690
|
-
changedFiles: entry.changedFiles,
|
|
1691
|
-
artifactPaths: entry.artifactPaths,
|
|
1692
|
-
summary: entry.summary,
|
|
1693
|
-
recordedAt: entry.recordedAt
|
|
1694
|
-
}); }),
|
|
1695
|
-
current: {
|
|
1696
|
-
outcome: 'needs_repair',
|
|
1697
|
-
lane: latestRecord === null || latestRecord === void 0 ? void 0 : latestRecord.lane,
|
|
1698
|
-
stepType: latestRecord === null || latestRecord === void 0 ? void 0 : latestRecord.stepType,
|
|
1699
|
-
failureClass: failureClass,
|
|
1700
|
-
blocker: input.blocker,
|
|
1701
|
-
evidenceHash: evidenceHash,
|
|
1702
|
-
changedFiles: cleanList(input.changedFiles, 40, 500),
|
|
1703
|
-
artifactPaths: cleanList(input.artifactPaths, 40, 500),
|
|
1704
|
-
summary: input.blocker
|
|
1705
|
-
},
|
|
1706
|
-
maxSameFailureRepeats: limit,
|
|
1707
|
-
maxPingPongTransitions: 3,
|
|
1708
|
-
infraFailureClasses: input.ignoreInfra !== false ? ['infra', 'compile'] : []
|
|
1709
|
-
});
|
|
1710
|
-
if (managerDecision.action === 'retry_infra') {
|
|
1711
|
-
return {
|
|
1712
|
-
shouldStop: false,
|
|
1713
|
-
repeatedCount: 0,
|
|
1714
|
-
failureClass: failureClass,
|
|
1715
|
-
blockerFingerprint: blockerFingerprint,
|
|
1716
|
-
evidenceHash: evidenceHash,
|
|
1717
|
-
reason: 'support_v5_infra_failures_do_not_count_as_product_repair_loops'
|
|
1718
|
-
};
|
|
1719
|
-
}
|
|
1720
|
-
if (managerDecision.action === 'park_ping_pong') {
|
|
1721
|
-
return {
|
|
1722
|
-
shouldStop: true,
|
|
1723
|
-
repeatedCount: managerDecision.pingPongCount,
|
|
1724
|
-
failureClass: failureClass,
|
|
1725
|
-
blockerFingerprint: blockerFingerprint,
|
|
1726
|
-
evidenceHash: evidenceHash,
|
|
1727
|
-
newEvidence: managerDecision.newEvidence,
|
|
1728
|
-
materialEvidence: managerDecision.materialEvidence,
|
|
1729
|
-
evidenceStrength: managerDecision.evidenceStrength,
|
|
1730
|
-
evidenceSignals: managerDecision.evidenceSignals,
|
|
1731
|
-
reason: 'support_v5_ping_pong_failure_loop'
|
|
1732
|
-
};
|
|
1733
|
-
}
|
|
1734
|
-
if (managerDecision.action === 'park_repeated_failure' && managerDecision.newEvidence && !managerDecision.materialEvidence) {
|
|
1735
|
-
return {
|
|
1736
|
-
shouldStop: true,
|
|
1737
|
-
repeatedCount: managerDecision.sameFailureCount,
|
|
1738
|
-
failureClass: failureClass,
|
|
1739
|
-
blockerFingerprint: blockerFingerprint,
|
|
1740
|
-
evidenceHash: evidenceHash,
|
|
1741
|
-
newEvidence: managerDecision.newEvidence,
|
|
1742
|
-
materialEvidence: managerDecision.materialEvidence,
|
|
1743
|
-
evidenceStrength: managerDecision.evidenceStrength,
|
|
1744
|
-
evidenceSignals: managerDecision.evidenceSignals,
|
|
1745
|
-
reason: 'support_v5_same_failure_with_weak_evidence'
|
|
1746
|
-
};
|
|
1747
|
-
}
|
|
1748
|
-
if (managerDecision.newEvidence && managerDecision.materialEvidence) {
|
|
1749
|
-
return {
|
|
1750
|
-
shouldStop: false,
|
|
1751
|
-
repeatedCount: managerDecision.sameFailureCount,
|
|
1752
|
-
failureClass: failureClass,
|
|
1753
|
-
blockerFingerprint: blockerFingerprint,
|
|
1754
|
-
evidenceHash: evidenceHash,
|
|
1755
|
-
newEvidence: managerDecision.newEvidence,
|
|
1756
|
-
materialEvidence: managerDecision.materialEvidence,
|
|
1757
|
-
evidenceStrength: managerDecision.evidenceStrength,
|
|
1758
|
-
evidenceSignals: managerDecision.evidenceSignals,
|
|
1759
|
-
reason: 'support_v5_retry_allowed_material_evidence'
|
|
1760
|
-
};
|
|
1761
|
-
}
|
|
1762
|
-
if (managerDecision.action === 'park_repeated_failure') {
|
|
1763
|
-
return {
|
|
1764
|
-
shouldStop: true,
|
|
1765
|
-
repeatedCount: managerDecision.sameFailureCount,
|
|
1766
|
-
failureClass: failureClass,
|
|
1767
|
-
blockerFingerprint: blockerFingerprint,
|
|
1768
|
-
evidenceHash: evidenceHash,
|
|
1769
|
-
newEvidence: managerDecision.newEvidence,
|
|
1770
|
-
materialEvidence: managerDecision.materialEvidence,
|
|
1771
|
-
evidenceStrength: managerDecision.evidenceStrength,
|
|
1772
|
-
evidenceSignals: managerDecision.evidenceSignals,
|
|
1773
|
-
reason: 'support_v5_same_failure_class_without_new_evidence'
|
|
1774
|
-
};
|
|
1775
|
-
}
|
|
1776
|
-
var repeatedCount = 0;
|
|
1777
|
-
for (var index = (input.history || []).length - 1; index >= 0; index -= 1) {
|
|
1778
|
-
var item = input.history[index];
|
|
1779
|
-
if (item.outcome === 'pass' || item.outcome === 'ready_for_merge') {
|
|
1780
|
-
break;
|
|
1781
|
-
}
|
|
1782
|
-
var itemFailureClass = cleanText(item.failureClass || 'unknown', 80).toLowerCase();
|
|
1783
|
-
var itemBlockerFingerprint = cleanText(item.blockerFingerprint, 80)
|
|
1784
|
-
|| fingerprintResolveIOSupportV5Blocker(item.blocker || item.summary || '');
|
|
1785
|
-
var itemEvidenceHash = cleanText(item.evidenceHash, 80)
|
|
1786
|
-
|| hashResolveIOSupportV5Evidence(item.artifactPaths || item.blocker || item.summary || '');
|
|
1787
|
-
if (itemFailureClass !== failureClass || itemBlockerFingerprint !== blockerFingerprint || itemEvidenceHash !== evidenceHash) {
|
|
1788
|
-
break;
|
|
1789
|
-
}
|
|
1790
|
-
repeatedCount += 1;
|
|
1791
|
-
}
|
|
1792
|
-
return {
|
|
1793
|
-
shouldStop: repeatedCount >= limit,
|
|
1794
|
-
repeatedCount: repeatedCount,
|
|
1795
|
-
failureClass: failureClass,
|
|
1796
|
-
blockerFingerprint: blockerFingerprint,
|
|
1797
|
-
evidenceHash: evidenceHash,
|
|
1798
|
-
newEvidence: managerDecision.newEvidence,
|
|
1799
|
-
materialEvidence: managerDecision.materialEvidence,
|
|
1800
|
-
evidenceStrength: managerDecision.evidenceStrength,
|
|
1801
|
-
evidenceSignals: managerDecision.evidenceSignals,
|
|
1802
|
-
reason: repeatedCount >= limit
|
|
1803
|
-
? 'support_v5_same_failure_class_without_new_evidence'
|
|
1804
|
-
: 'support_v5_retry_allowed_new_or_below_repeat_limit'
|
|
1805
|
-
};
|
|
1806
|
-
}
|
|
1807
|
-
function evaluateResolveIOSupportEvidenceFreshness(input) {
|
|
1808
|
-
var _a;
|
|
1809
|
-
var history = Array.isArray(input.history) ? input.history : [];
|
|
1810
|
-
var latest = history.length ? history[history.length - 1] : undefined;
|
|
1811
|
-
var rawFailureClass = cleanText(input.failureClass || (latest === null || latest === void 0 ? void 0 : latest.failureClass), 80).toLowerCase();
|
|
1812
|
-
var failureClass = rawFailureClass || 'unknown';
|
|
1813
|
-
var blocker = cleanText(input.blocker || (latest === null || latest === void 0 ? void 0 : latest.blocker) || (latest === null || latest === void 0 ? void 0 : latest.summary), 1200);
|
|
1814
|
-
var changedFiles = cleanList(input.changedFiles || (latest === null || latest === void 0 ? void 0 : latest.changedFiles), 40, 500);
|
|
1815
|
-
var artifactPaths = cleanList(input.artifactPaths || (latest === null || latest === void 0 ? void 0 : latest.artifactPaths), 40, 500);
|
|
1816
|
-
var explicitEvidenceHash = cleanText(input.evidenceHash || (latest === null || latest === void 0 ? void 0 : latest.evidenceHash), 120);
|
|
1817
|
-
var evidenceHash = explicitEvidenceHash || hashResolveIOSupportV5Evidence(input.evidence || artifactPaths || blocker || (latest === null || latest === void 0 ? void 0 : latest.summary) || '');
|
|
1818
|
-
var blockerFingerprint = fingerprintResolveIOSupportV5Blocker(blocker || (latest === null || latest === void 0 ? void 0 : latest.summary) || '');
|
|
1819
|
-
var missing = !history.length && !rawFailureClass && !blocker && !explicitEvidenceHash && !artifactPaths.length && !changedFiles.length;
|
|
1820
|
-
if (missing) {
|
|
1821
|
-
return {
|
|
1822
|
-
status: 'missing',
|
|
1823
|
-
failureClass: '',
|
|
1824
|
-
blockerFingerprint: '',
|
|
1825
|
-
evidenceHash: '',
|
|
1826
|
-
sameFailureCount: 0,
|
|
1827
|
-
pingPongCount: 0,
|
|
1828
|
-
newEvidence: false,
|
|
1829
|
-
materialEvidence: false,
|
|
1830
|
-
evidenceStrength: 'none',
|
|
1831
|
-
evidenceSignals: [],
|
|
1832
|
-
loopBudgetShouldReset: false,
|
|
1833
|
-
canRetry: true,
|
|
1834
|
-
mustCollectNewEvidence: false,
|
|
1835
|
-
productRepairFailure: false,
|
|
1836
|
-
reason: 'support_evidence_freshness_waiting_for_first_failure_or_proof',
|
|
1837
|
-
requiredResetEvidence: [
|
|
1838
|
-
'current blocker fingerprint',
|
|
1839
|
-
'evidence hash',
|
|
1840
|
-
'artifact path when available'
|
|
1841
|
-
],
|
|
1842
|
-
changedFiles: changedFiles,
|
|
1843
|
-
artifactPaths: artifactPaths
|
|
1844
|
-
};
|
|
1845
|
-
}
|
|
1846
|
-
var current = {
|
|
1847
|
-
outcome: 'needs_repair',
|
|
1848
|
-
lane: cleanText(input.lane || (latest === null || latest === void 0 ? void 0 : latest.lane), 80) || (latest === null || latest === void 0 ? void 0 : latest.lane),
|
|
1849
|
-
stepType: cleanText(input.stepType || (latest === null || latest === void 0 ? void 0 : latest.stepType), 80) || (latest === null || latest === void 0 ? void 0 : latest.stepType),
|
|
1850
|
-
failureClass: failureClass,
|
|
1851
|
-
blocker: blocker,
|
|
1852
|
-
evidenceHash: evidenceHash,
|
|
1853
|
-
changedFiles: changedFiles,
|
|
1854
|
-
artifactPaths: artifactPaths,
|
|
1855
|
-
summary: blocker
|
|
1856
|
-
};
|
|
1857
|
-
var policy = (0, ai_runner_manager_policy_1.decideResolveIOAIManagerPolicy)({
|
|
1858
|
-
history: history.map(function (entry) { return ({
|
|
1859
|
-
outcome: entry.outcome,
|
|
1860
|
-
lane: entry.lane,
|
|
1861
|
-
stepType: entry.stepType,
|
|
1862
|
-
failureClass: entry.failureClass,
|
|
1863
|
-
blocker: entry.blocker || entry.summary,
|
|
1864
|
-
evidenceHash: entry.evidenceHash,
|
|
1865
|
-
changedFiles: entry.changedFiles,
|
|
1866
|
-
artifactPaths: entry.artifactPaths,
|
|
1867
|
-
summary: entry.summary,
|
|
1868
|
-
recordedAt: entry.recordedAt
|
|
1869
|
-
}); }),
|
|
1870
|
-
current: current,
|
|
1871
|
-
maxSameFailureRepeats: Math.max(1, Number(input.limit || 2) || 2),
|
|
1872
|
-
maxPingPongTransitions: 3,
|
|
1873
|
-
infraFailureClasses: input.ignoreInfra !== false ? ['infra', 'compile'] : []
|
|
1874
|
-
});
|
|
1875
|
-
var status = 'retry_below_limit';
|
|
1876
|
-
if (policy.action === 'retry_infra') {
|
|
1877
|
-
status = 'infra_ignored';
|
|
1878
|
-
}
|
|
1879
|
-
else if (policy.action === 'park_ping_pong') {
|
|
1880
|
-
status = 'ping_pong';
|
|
1881
|
-
}
|
|
1882
|
-
else if (policy.action === 'park_repeated_failure') {
|
|
1883
|
-
status = policy.newEvidence ? 'weak_evidence' : 'stale_repeated';
|
|
1884
|
-
}
|
|
1885
|
-
else if (policy.newEvidence && policy.materialEvidence) {
|
|
1886
|
-
status = 'material_evidence';
|
|
1887
|
-
}
|
|
1888
|
-
else if (policy.newEvidence && !policy.materialEvidence) {
|
|
1889
|
-
status = 'weak_evidence';
|
|
1890
|
-
}
|
|
1891
|
-
else if (policy.loopBudgetShouldReset || policy.reason === 'manager_policy_new_failure_or_lane') {
|
|
1892
|
-
status = 'fresh';
|
|
1893
|
-
}
|
|
1894
|
-
var mustCollectNewEvidence = policy.action === 'park_repeated_failure'
|
|
1895
|
-
|| policy.action === 'park_ping_pong';
|
|
1896
|
-
return {
|
|
1897
|
-
status: status,
|
|
1898
|
-
failureClass: policy.failureClass,
|
|
1899
|
-
blockerFingerprint: blockerFingerprint || policy.blockerFingerprint,
|
|
1900
|
-
evidenceHash: policy.evidenceHash,
|
|
1901
|
-
sameFailureCount: policy.sameFailureCount,
|
|
1902
|
-
pingPongCount: policy.pingPongCount,
|
|
1903
|
-
newEvidence: policy.newEvidence,
|
|
1904
|
-
materialEvidence: policy.materialEvidence,
|
|
1905
|
-
evidenceStrength: policy.evidenceStrength,
|
|
1906
|
-
evidenceSignals: policy.evidenceSignals,
|
|
1907
|
-
loopBudgetShouldReset: policy.loopBudgetShouldReset,
|
|
1908
|
-
canRetry: !mustCollectNewEvidence,
|
|
1909
|
-
mustCollectNewEvidence: mustCollectNewEvidence,
|
|
1910
|
-
productRepairFailure: policy.productRepairFailure,
|
|
1911
|
-
reason: policy.reason,
|
|
1912
|
-
requiredResetEvidence: Array.from(new Set(__spreadArray(__spreadArray([], __read(cleanList(policy.recoveryPlan.loopResetEvidence, 12, 500)), false), __read(cleanList((_a = policy.recoveryAction) === null || _a === void 0 ? void 0 : _a.successCriteria, 12, 500)), false))).slice(0, 18),
|
|
1913
|
-
changedFiles: changedFiles,
|
|
1914
|
-
artifactPaths: artifactPaths
|
|
1915
|
-
};
|
|
1916
|
-
}
|
|
1917
|
-
function buildResolveIOSupportContinuationProofCheckpoint(input) {
|
|
1918
|
-
var evidenceFreshness = input.evidenceFreshness;
|
|
1919
|
-
var action = input.action;
|
|
1920
|
-
var requiredEvidence = cleanList(input.requiredEvidence, 20, 500);
|
|
1921
|
-
var requiredResetEvidence = Array.from(new Set(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(cleanList(input.requiredResetEvidence, 20, 500)), false), __read(cleanList(evidenceFreshness === null || evidenceFreshness === void 0 ? void 0 : evidenceFreshness.requiredResetEvidence, 20, 500)), false), __read((action === 'run_diagnosis_gate'
|
|
1922
|
-
? [
|
|
1923
|
-
'accepted SupportDiagnosisGate with reproduced/blocked issue case',
|
|
1924
|
-
'bounded owner_files and before/action/after proof_plan'
|
|
1925
|
-
]
|
|
1926
|
-
: [])), false), __read((action === 'collect_new_evidence'
|
|
1927
|
-
? [
|
|
1928
|
-
'fresh issue-class probe artifact',
|
|
1929
|
-
'changed blockerFingerprint or evidenceHash',
|
|
1930
|
-
'AIQaBusinessAssertion or before/action/after blocker artifact'
|
|
1931
|
-
]
|
|
1932
|
-
: [])), false), __read((action === 'repair_infra_only'
|
|
1933
|
-
? [
|
|
1934
|
-
'infra or compile gate passes, or failureClass changes',
|
|
1935
|
-
'new evidenceHash from fresh preflight/build artifact'
|
|
1936
|
-
]
|
|
1937
|
-
: [])), false), __read((action === 'repair_release_hotfix_first'
|
|
1938
|
-
? [
|
|
1939
|
-
'GitHub commit proof recorded before live backend hotfix',
|
|
1940
|
-
'release gate or hotfix durability evidence refreshed'
|
|
1941
|
-
]
|
|
1942
|
-
: [])), false))).slice(0, 20);
|
|
1943
|
-
var blocksProductRepair = input.blocksProductRepair === true
|
|
1944
|
-
|| action === 'collect_new_evidence'
|
|
1945
|
-
|| action === 'run_diagnosis_gate'
|
|
1946
|
-
|| action === 'ask_customer_clarification'
|
|
1947
|
-
|| action === 'repair_infra_only'
|
|
1948
|
-
|| action === 'revise_diagnosis_scope';
|
|
1949
|
-
var waitingForNewEvidence = (evidenceFreshness === null || evidenceFreshness === void 0 ? void 0 : evidenceFreshness.mustCollectNewEvidence) === true
|
|
1950
|
-
|| action === 'collect_new_evidence';
|
|
1951
|
-
var proofRequired = requiredEvidence.length > 0 || requiredResetEvidence.length > 0;
|
|
1952
|
-
var status = waitingForNewEvidence
|
|
1953
|
-
? 'waiting_for_new_evidence'
|
|
1954
|
-
: proofRequired
|
|
1955
|
-
? 'waiting_for_proof'
|
|
1956
|
-
: 'waiting_for_state_transition';
|
|
1957
|
-
return {
|
|
1958
|
-
required: true,
|
|
1959
|
-
status: status,
|
|
1960
|
-
action: action,
|
|
1961
|
-
reason: cleanText(input.reason || (evidenceFreshness === null || evidenceFreshness === void 0 ? void 0 : evidenceFreshness.reason) || '', 1000),
|
|
1962
|
-
startingFailureClass: cleanText(evidenceFreshness === null || evidenceFreshness === void 0 ? void 0 : evidenceFreshness.failureClass, 120),
|
|
1963
|
-
startingBlockerFingerprint: cleanText(evidenceFreshness === null || evidenceFreshness === void 0 ? void 0 : evidenceFreshness.blockerFingerprint, 160),
|
|
1964
|
-
startingEvidenceHash: cleanText(evidenceFreshness === null || evidenceFreshness === void 0 ? void 0 : evidenceFreshness.evidenceHash, 160),
|
|
1965
|
-
requiredEvidence: requiredEvidence,
|
|
1966
|
-
requiredResetEvidence: requiredResetEvidence,
|
|
1967
|
-
successRequiresNewEvidence: waitingForNewEvidence || blocksProductRepair,
|
|
1968
|
-
blocksProductRepairUntilChangedEvidence: blocksProductRepair,
|
|
1969
|
-
nextAction: waitingForNewEvidence
|
|
1970
|
-
? 'collect_required_reset_evidence'
|
|
1971
|
-
: action
|
|
1972
|
-
};
|
|
1973
|
-
}
|
|
1974
|
-
function changedFilesOutsideResolveIOSupportDiagnosisOwnerFiles(diagnosisGate, changedFiles, options) {
|
|
1975
|
-
if (options === void 0) { options = {}; }
|
|
1976
|
-
var validation = validateResolveIOSupportDiagnosisGate(diagnosisGate);
|
|
1977
|
-
if (!validation.valid || !validation.normalized) {
|
|
1978
|
-
return cleanList(changedFiles, 80, 500);
|
|
1979
|
-
}
|
|
1980
|
-
var owners = new Set(validation.normalized.owner_files.map(normalizeOwnerFilePath));
|
|
1981
|
-
return cleanList(changedFiles, 120, 500)
|
|
1982
|
-
.map(normalizeOwnerFilePath)
|
|
1983
|
-
.filter(function (filePath) {
|
|
1984
|
-
if (!filePath) {
|
|
1985
|
-
return false;
|
|
1986
|
-
}
|
|
1987
|
-
if (owners.has(filePath)) {
|
|
1988
|
-
return false;
|
|
1989
|
-
}
|
|
1990
|
-
if (options.allowTests && /(^|\/)(tests?|spec|__tests__)(\/|$)|\.(?:spec|test)\.[jt]sx?$/i.test(filePath)) {
|
|
1991
|
-
return false;
|
|
1992
|
-
}
|
|
1993
|
-
return true;
|
|
1994
|
-
});
|
|
1995
|
-
}
|
|
1996
|
-
function decideResolveIOSupportV5RepairGate(input) {
|
|
1997
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
1998
|
-
var activeStepType = cleanText(input.activeStepType, 80);
|
|
1999
|
-
var failureClass = cleanText(input.failureClass, 80).toLowerCase();
|
|
2000
|
-
var diagnosisValidation = validateResolveIOSupportDiagnosisGate(input.diagnosisGate, {
|
|
2001
|
-
maxOwnerFiles: input.maxOwnerFiles
|
|
2002
|
-
});
|
|
2003
|
-
var ownerFiles = ((_a = diagnosisValidation.normalized) === null || _a === void 0 ? void 0 : _a.owner_files) || [];
|
|
2004
|
-
var outsideOwnerFiles = changedFilesOutsideResolveIOSupportDiagnosisOwnerFiles(diagnosisValidation.normalized || input.diagnosisGate, input.changedFiles, { allowTests: input.allowTestsOutsideOwnerFiles === true });
|
|
2005
|
-
var repeatedFailure = ((_b = input.history) === null || _b === void 0 ? void 0 : _b.length) ? decideResolveIOSupportV5RepeatedFailureStop({
|
|
2006
|
-
history: input.history,
|
|
2007
|
-
failureClass: failureClass,
|
|
2008
|
-
blocker: input.blocker,
|
|
2009
|
-
evidence: input.evidence,
|
|
2010
|
-
evidenceHash: input.evidenceHash,
|
|
2011
|
-
changedFiles: input.changedFiles,
|
|
2012
|
-
artifactPaths: input.artifactPaths,
|
|
2013
|
-
limit: Math.max(1, Number(input.maxRepeatedNoProgress || 2) || 2),
|
|
2014
|
-
ignoreInfra: true
|
|
2015
|
-
}) : undefined;
|
|
2016
|
-
var recoveryPlanFor = function (action, reason, recoveryFailureClass, productRepairFailure) {
|
|
2017
|
-
if (recoveryFailureClass === void 0) { recoveryFailureClass = failureClass || 'unknown'; }
|
|
2018
|
-
if (productRepairFailure === void 0) { productRepairFailure = false; }
|
|
2019
|
-
return (0, ai_runner_manager_policy_1.buildResolveIOAIManagerRecoveryPlan)({
|
|
2020
|
-
action: action,
|
|
2021
|
-
reason: reason,
|
|
2022
|
-
failureClass: recoveryFailureClass,
|
|
2023
|
-
lane: 'build',
|
|
2024
|
-
stepType: activeStepType || 'build_repair',
|
|
2025
|
-
blocker: input.blocker || (diagnosisValidation.blockers || []).join(' | '),
|
|
2026
|
-
changedFiles: cleanList(input.changedFiles, 40, 500),
|
|
2027
|
-
maxSameFailureRepeats: Math.max(1, Number(input.maxRepeatedNoProgress || 2) || 2),
|
|
2028
|
-
productRepairFailure: productRepairFailure
|
|
2029
|
-
});
|
|
2030
|
-
};
|
|
2031
|
-
var recoveryCheckpointFor = function (recoveryPlan) { return (0, ai_runner_manager_policy_1.buildResolveIOAIManagerRecoveryCheckpoint)({
|
|
2032
|
-
plan: recoveryPlan,
|
|
2033
|
-
current: {
|
|
2034
|
-
lane: 'build',
|
|
2035
|
-
stepType: activeStepType || 'build_repair',
|
|
2036
|
-
failureClass: failureClass || 'unknown',
|
|
2037
|
-
blocker: input.blocker || (diagnosisValidation.blockers || []).join(' | '),
|
|
2038
|
-
evidenceHash: input.evidenceHash,
|
|
2039
|
-
changedFiles: cleanList(input.changedFiles, 40, 500),
|
|
2040
|
-
summary: input.blocker
|
|
2041
|
-
}
|
|
2042
|
-
}); };
|
|
2043
|
-
var recoveryFieldsFor = function (recoveryPlan) {
|
|
2044
|
-
var recoveryCheckpoint = recoveryCheckpointFor(recoveryPlan);
|
|
2045
|
-
var recoveryEvidenceProbe = (0, ai_runner_manager_policy_1.buildResolveIOAIManagerRecoveryEvidenceProbe)({
|
|
2046
|
-
checkpoint: recoveryCheckpoint,
|
|
2047
|
-
current: {
|
|
2048
|
-
lane: 'build',
|
|
2049
|
-
stepType: activeStepType || 'build_repair',
|
|
2050
|
-
failureClass: failureClass || 'unknown',
|
|
2051
|
-
blocker: input.blocker || (diagnosisValidation.blockers || []).join(' | '),
|
|
2052
|
-
evidenceHash: input.evidenceHash,
|
|
2053
|
-
changedFiles: cleanList(input.changedFiles, 40, 500),
|
|
2054
|
-
summary: input.blocker
|
|
2055
|
-
}
|
|
2056
|
-
});
|
|
2057
|
-
var current = {
|
|
2058
|
-
lane: 'build',
|
|
2059
|
-
stepType: activeStepType || 'build_repair',
|
|
2060
|
-
failureClass: failureClass || 'unknown',
|
|
2061
|
-
blocker: input.blocker || (diagnosisValidation.blockers || []).join(' | '),
|
|
2062
|
-
evidenceHash: input.evidenceHash,
|
|
2063
|
-
changedFiles: cleanList(input.changedFiles, 40, 500),
|
|
2064
|
-
summary: input.blocker
|
|
2065
|
-
};
|
|
2066
|
-
return {
|
|
2067
|
-
recoveryPlan: recoveryPlan,
|
|
2068
|
-
recoveryCheckpoint: recoveryCheckpoint,
|
|
2069
|
-
recoveryEvidenceProbe: recoveryEvidenceProbe,
|
|
2070
|
-
recoveryAction: (0, ai_runner_manager_policy_1.buildResolveIOAIManagerRecoveryActionPacket)({
|
|
2071
|
-
plan: recoveryPlan,
|
|
2072
|
-
checkpoint: recoveryCheckpoint,
|
|
2073
|
-
probe: recoveryEvidenceProbe,
|
|
2074
|
-
current: current
|
|
2075
|
-
})
|
|
2076
|
-
};
|
|
2077
|
-
};
|
|
2078
|
-
if (repeatedFailure === null || repeatedFailure === void 0 ? void 0 : repeatedFailure.shouldStop) {
|
|
2079
|
-
var recoveryPlan_1 = recoveryPlanFor('park_repeated_failure', repeatedFailure.reason, repeatedFailure.failureClass, true);
|
|
2080
|
-
return __assign({ action: 'park_repeated_failure', canEditProductCode: false, blockers: [repeatedFailure.reason], ownerFiles: ownerFiles, issueClass: (_c = diagnosisValidation.normalized) === null || _c === void 0 ? void 0 : _c.issue_class, proofPlan: (_d = diagnosisValidation.normalized) === null || _d === void 0 ? void 0 : _d.proof_plan, outsideOwnerFiles: outsideOwnerFiles, repeatedFailure: repeatedFailure, diagnosisValidation: diagnosisValidation }, recoveryFieldsFor(recoveryPlan_1));
|
|
2081
|
-
}
|
|
2082
|
-
if (failureClass === 'infra' || failureClass === 'compile') {
|
|
2083
|
-
var recoveryPlan_2 = recoveryPlanFor('retry_infra', 'support_v5_infra_or_compile_repair_required', failureClass, false);
|
|
2084
|
-
return __assign({ action: 'infra_repair_only', canEditProductCode: false, blockers: ['Infra/compile/Puppeteer/startup failures must be repaired in the harness lane before product-code repair.'], ownerFiles: ownerFiles, issueClass: (_e = diagnosisValidation.normalized) === null || _e === void 0 ? void 0 : _e.issue_class, proofPlan: (_f = diagnosisValidation.normalized) === null || _f === void 0 ? void 0 : _f.proof_plan, outsideOwnerFiles: outsideOwnerFiles, repeatedFailure: repeatedFailure, diagnosisValidation: diagnosisValidation }, recoveryFieldsFor(recoveryPlan_2));
|
|
2085
|
-
}
|
|
2086
|
-
if (activeStepType === 'diagnosis_gate' || !diagnosisValidation.valid) {
|
|
2087
|
-
var recoveryPlan_3 = recoveryPlanFor('continue', 'support_v5_diagnosis_gate_required', 'diagnosis', false);
|
|
2088
|
-
return __assign({ action: 'diagnose_only', canEditProductCode: false, blockers: diagnosisValidation.blockers.length
|
|
2089
|
-
? diagnosisValidation.blockers
|
|
2090
|
-
: ['SupportDiagnosisGate is required before product-code repair.'], ownerFiles: ownerFiles, issueClass: (_g = diagnosisValidation.normalized) === null || _g === void 0 ? void 0 : _g.issue_class, proofPlan: (_h = diagnosisValidation.normalized) === null || _h === void 0 ? void 0 : _h.proof_plan, outsideOwnerFiles: outsideOwnerFiles, repeatedFailure: repeatedFailure, diagnosisValidation: diagnosisValidation }, recoveryFieldsFor(recoveryPlan_3));
|
|
2091
|
-
}
|
|
2092
|
-
if (outsideOwnerFiles.length) {
|
|
2093
|
-
var recoveryPlan_4 = recoveryPlanFor('continue', 'support_v5_out_of_scope_requires_diagnosis_revision', 'owner_scope', false);
|
|
2094
|
-
return __assign({ action: 'reject_out_of_scope', canEditProductCode: false, blockers: ["Changed files outside diagnosis owner_files; revise diagnosis with new evidence before broadening edits: ".concat(outsideOwnerFiles.join(', '))], ownerFiles: ownerFiles, issueClass: (_j = diagnosisValidation.normalized) === null || _j === void 0 ? void 0 : _j.issue_class, proofPlan: (_k = diagnosisValidation.normalized) === null || _k === void 0 ? void 0 : _k.proof_plan, outsideOwnerFiles: outsideOwnerFiles, repeatedFailure: repeatedFailure, diagnosisValidation: diagnosisValidation }, recoveryFieldsFor(recoveryPlan_4));
|
|
2095
|
-
}
|
|
2096
|
-
var recoveryPlan = recoveryPlanFor('continue', 'support_v5_product_repair_allowed_after_diagnosis', failureClass || 'product_code', true);
|
|
2097
|
-
return __assign({ action: 'allow_product_repair', canEditProductCode: true, blockers: [], ownerFiles: ownerFiles, issueClass: (_l = diagnosisValidation.normalized) === null || _l === void 0 ? void 0 : _l.issue_class, proofPlan: (_m = diagnosisValidation.normalized) === null || _m === void 0 ? void 0 : _m.proof_plan, outsideOwnerFiles: outsideOwnerFiles, repeatedFailure: repeatedFailure, diagnosisValidation: diagnosisValidation }, recoveryFieldsFor(recoveryPlan));
|
|
2098
|
-
}
|
|
2099
|
-
function applyResolveIOSupportDiagnosisGateToMicrotasks(bundle, diagnosisGate) {
|
|
2100
|
-
var _a;
|
|
2101
|
-
var validation = validateResolveIOSupportDiagnosisGate(diagnosisGate);
|
|
2102
|
-
var gate = validation.normalized;
|
|
2103
|
-
if (!gate) {
|
|
2104
|
-
return bundle;
|
|
2105
|
-
}
|
|
2106
|
-
var ownerFiles = gate.owner_files;
|
|
2107
|
-
var probes = buildResolveIOSupportIssueClassProbes(gate);
|
|
2108
|
-
var proofContract = gate.proof_plan.business_proof_contract;
|
|
2109
|
-
var businessProof = (proofContract === null || proofContract === void 0 ? void 0 : proofContract.expected_business_state_change) || gate.proof_plan.business_assertion;
|
|
2110
|
-
var businessAssertion = (proofContract === null || proofContract === void 0 ? void 0 : proofContract.data_or_dom_assertion) || gate.proof_plan.data_assertion || gate.proof_plan.after;
|
|
2111
|
-
var now = isoNow();
|
|
2112
|
-
var diagnosisMicrotaskId = ((_a = (bundle.supportV5MicrotaskLedger || [])
|
|
2113
|
-
.find(function (task) { return task.type === 'diagnosis_gate'; })) === null || _a === void 0 ? void 0 : _a.microtaskId)
|
|
2114
|
-
|| stableIdFromText('diagnosis', "Root-cause-first diagnosis gate for: ".concat(cleanText(bundle.supportV5ScopeDigest || gate.issue_case.customer_complaint, 360) || 'support ticket'));
|
|
2115
|
-
var ledger = (bundle.supportV5MicrotaskLedger || []).map(function (task) {
|
|
2116
|
-
var _a;
|
|
2117
|
-
if (task.type === 'diagnosis_gate') {
|
|
2118
|
-
return __assign(__assign({}, task), { status: validation.valid ? 'pass' : 'needs_repair', blocker: validation.valid ? '' : validation.blockers.join(' | '), updatedAt: now });
|
|
2119
|
-
}
|
|
2120
|
-
if (task.lane === 'build' && /repair|product_repair|build_repair/i.test(String(task.type || ''))) {
|
|
2121
|
-
return __assign(__assign({}, task), { targetFiles: ownerFiles, contextRefs: Array.from(new Set(__spreadArray(__spreadArray([], __read((task.contextRefs || [])), false), ['supportV5DiagnosisGate', 'owner_files'], false))), selfGate: "Repair only the diagnosed owner files unless you revise the diagnosis with new evidence. Owner files: ".concat(ownerFiles.join(', '), "."), acceptanceProof: businessProof, dependsOn: Array.from(new Set(__spreadArray(__spreadArray([], __read((task.dependsOn || [])), false), [diagnosisMicrotaskId], false))), updatedAt: now });
|
|
2122
|
-
}
|
|
2123
|
-
if (task.lane === 'qa' && task.type === 'qa_row') {
|
|
2124
|
-
return __assign(__assign({}, task), { contextRefs: Array.from(new Set(__spreadArray(__spreadArray([], __read((task.contextRefs || [])), false), ['supportV5DiagnosisGate', 'proof_plan'], false))), selfGate: ((_a = probes[0]) === null || _a === void 0 ? void 0 : _a.action) || task.selfGate, acceptanceProof: businessProof || task.acceptanceProof, targetFiles: ownerFiles, updatedAt: now });
|
|
2125
|
-
}
|
|
2126
|
-
return task;
|
|
2127
|
-
});
|
|
2128
|
-
var nextActive = selectResolveIOSupportV5ActiveMicrotask(ledger, bundle.supportV5ActiveMicrotaskId);
|
|
2129
|
-
return __assign(__assign({}, bundle), { supportV5DiagnosisGate: gate, supportV5MicrotaskLedger: ledger, supportV5ActiveMicrotaskId: nextActive === null || nextActive === void 0 ? void 0 : nextActive.microtaskId, supportV5LaneMemory: __assign(__assign({}, bundle.supportV5LaneMemory), { build: __assign(__assign({}, bundle.supportV5LaneMemory.build), { changedFiles: ownerFiles, scopeSummary: [
|
|
2130
|
-
bundle.supportV5LaneMemory.build.scopeSummary,
|
|
2131
|
-
"Diagnosis issue class: ".concat(gate.issue_class),
|
|
2132
|
-
"Accepted hypothesis: ".concat(gate.accepted_hypothesis.statement),
|
|
2133
|
-
"Owner files: ".concat(ownerFiles.join(', '))
|
|
2134
|
-
].filter(Boolean).join(' | '), updatedAt: now }), qa: __assign(__assign({}, bundle.supportV5LaneMemory.qa), { activeQaRow: {
|
|
2135
|
-
workflow: (proofContract === null || proofContract === void 0 ? void 0 : proofContract.action_under_test) || gate.proof_plan.action,
|
|
2136
|
-
route: gate.proof_plan.route || gate.issue_case.route_module,
|
|
2137
|
-
assertion: businessAssertion,
|
|
2138
|
-
status: 'pending'
|
|
2139
|
-
}, updatedAt: now }) }) });
|
|
2140
|
-
}
|
|
2141
|
-
function stableIdFromText(prefix, value) {
|
|
2142
|
-
var text = cleanText(value, 2000).toLowerCase();
|
|
2143
|
-
var hash = 0;
|
|
2144
|
-
for (var index = 0; index < text.length; index += 1) {
|
|
2145
|
-
hash = ((hash << 5) - hash + text.charCodeAt(index)) | 0;
|
|
2146
|
-
}
|
|
2147
|
-
return "".concat(prefix, "-").concat(Math.abs(hash).toString(36) || '0');
|
|
2148
|
-
}
|
|
2149
|
-
function estimateTextTokens(value) {
|
|
2150
|
-
var text = String(value || '');
|
|
2151
|
-
if (!text) {
|
|
2152
|
-
return 0;
|
|
2153
|
-
}
|
|
2154
|
-
return Math.max(1, Math.ceil(text.length / 4));
|
|
2155
|
-
}
|
|
2156
|
-
function fingerprintResolveIOSupportV5Blocker(value) {
|
|
2157
|
-
var text = cleanText(value, 4000)
|
|
2158
|
-
.toLowerCase()
|
|
2159
|
-
.replace(/[a-f0-9]{16,}/g, '<id>')
|
|
2160
|
-
.replace(/\b\d{2,}\b/g, '<n>')
|
|
2161
|
-
.replace(/\bline\s+<n>\b/g, 'line <n>');
|
|
2162
|
-
var hash = 0;
|
|
2163
|
-
for (var index = 0; index < text.length; index += 1) {
|
|
2164
|
-
hash = ((hash << 5) - hash + text.charCodeAt(index)) | 0;
|
|
2165
|
-
}
|
|
2166
|
-
return "v5-".concat(Math.abs(hash).toString(36));
|
|
2167
|
-
}
|
|
2168
|
-
function buildResolveIOSupportV5Budget(existing) {
|
|
2169
|
-
return {
|
|
2170
|
-
maxPromptTokensPerNonInitialStep: Number((existing === null || existing === void 0 ? void 0 : existing.maxPromptTokensPerNonInitialStep) || 1800),
|
|
2171
|
-
maxLoopsPerTicket: Number((existing === null || existing === void 0 ? void 0 : existing.maxLoopsPerTicket) || 24),
|
|
2172
|
-
maxRepeatedNoProgress: Number((existing === null || existing === void 0 ? void 0 : existing.maxRepeatedNoProgress) || 2),
|
|
2173
|
-
maxRuntimeMinutesPerLoop: Number((existing === null || existing === void 0 ? void 0 : existing.maxRuntimeMinutesPerLoop) || 15),
|
|
2174
|
-
totalPromptTokenEstimate: Number((existing === null || existing === void 0 ? void 0 : existing.totalPromptTokenEstimate) || 0),
|
|
2175
|
-
totalRuntimeMs: Number((existing === null || existing === void 0 ? void 0 : existing.totalRuntimeMs) || 0),
|
|
2176
|
-
loopCount: Number((existing === null || existing === void 0 ? void 0 : existing.loopCount) || 0)
|
|
2177
|
-
};
|
|
2178
|
-
}
|
|
2179
|
-
function buildResolveIOSupportV5PromptBudget(existing) {
|
|
2180
|
-
return {
|
|
2181
|
-
initialPlannerCap: Number((existing === null || existing === void 0 ? void 0 : existing.initialPlannerCap) || 6000),
|
|
2182
|
-
buildMicrotaskCap: Number((existing === null || existing === void 0 ? void 0 : existing.buildMicrotaskCap) || 1800),
|
|
2183
|
-
buildMicrotaskHardCap: Number((existing === null || existing === void 0 ? void 0 : existing.buildMicrotaskHardCap) || 2500),
|
|
2184
|
-
qaMicrotaskCap: Number((existing === null || existing === void 0 ? void 0 : existing.qaMicrotaskCap) || 1500),
|
|
2185
|
-
qaMicrotaskHardCap: Number((existing === null || existing === void 0 ? void 0 : existing.qaMicrotaskHardCap) || 2200),
|
|
2186
|
-
repairMicrotaskCap: Number((existing === null || existing === void 0 ? void 0 : existing.repairMicrotaskCap) || 1200),
|
|
2187
|
-
repairMicrotaskHardCap: Number((existing === null || existing === void 0 ? void 0 : existing.repairMicrotaskHardCap) || 1800)
|
|
2188
|
-
};
|
|
2189
|
-
}
|
|
2190
|
-
function buildResolveIOSupportV5ScopeDigest(input) {
|
|
2191
|
-
var scope = Array.isArray(input.approvedScope)
|
|
2192
|
-
? cleanList(input.approvedScope, 30, 220).join(' | ')
|
|
2193
|
-
: cleanText(input.approvedScope, 4000);
|
|
2194
|
-
var raw = [
|
|
2195
|
-
input.goal ? "Goal: ".concat(cleanText(input.goal, 300)) : '',
|
|
2196
|
-
scope ? "Approved scope: ".concat(scope) : '',
|
|
2197
|
-
input.prBranch ? "PR branch: ".concat(cleanText(input.prBranch, 160)) : ''
|
|
2198
|
-
].filter(Boolean).join('\n');
|
|
2199
|
-
var maxChars = Math.max(400, Math.floor(Number(input.maxTokens || 1000) * 4));
|
|
2200
|
-
return raw.slice(0, maxChars);
|
|
2201
|
-
}
|
|
2202
|
-
function buildResolveIOSupportV5MicrotaskLedger(input) {
|
|
2203
|
-
var e_7, _a;
|
|
2204
|
-
var existing = Array.isArray(input.existing) ? input.existing : [];
|
|
2205
|
-
var completedByObjective = new Map();
|
|
2206
|
-
try {
|
|
2207
|
-
for (var existing_1 = __values(existing), existing_1_1 = existing_1.next(); !existing_1_1.done; existing_1_1 = existing_1.next()) {
|
|
2208
|
-
var task = existing_1_1.value;
|
|
2209
|
-
if (task && (task.status === 'pass' || task.status === 'parked')) {
|
|
2210
|
-
completedByObjective.set(cleanText(task.objective, 500).toLowerCase(), task);
|
|
2211
|
-
}
|
|
2212
|
-
}
|
|
2213
|
-
}
|
|
2214
|
-
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
2215
|
-
finally {
|
|
2216
|
-
try {
|
|
2217
|
-
if (existing_1_1 && !existing_1_1.done && (_a = existing_1.return)) _a.call(existing_1);
|
|
2218
|
-
}
|
|
2219
|
-
finally { if (e_7) throw e_7.error; }
|
|
2220
|
-
}
|
|
2221
|
-
var now = isoNow(input.now);
|
|
2222
|
-
var requirements = cleanList(input.requirements, 30, 240);
|
|
2223
|
-
var sourceRequirements = requirements.length
|
|
2224
|
-
? requirements
|
|
2225
|
-
: cleanText(input.scopeDigest, 1000).split(/\s+\|\s+|\r?\n/g).map(function (line) { return line.trim(); }).filter(Boolean).slice(0, 12);
|
|
2226
|
-
var ledger = [];
|
|
2227
|
-
var diagnosisObjective = "Root-cause-first diagnosis gate for: ".concat(cleanText(input.scopeDigest, 360) || 'support ticket');
|
|
2228
|
-
var diagnosisId = stableIdFromText('diagnosis', diagnosisObjective);
|
|
2229
|
-
var existingDiagnosis = existing.find(function (task) { return (task === null || task === void 0 ? void 0 : task.type) === 'diagnosis_gate' || (task === null || task === void 0 ? void 0 : task.microtaskId) === diagnosisId; });
|
|
2230
|
-
ledger.push(existingDiagnosis && (existingDiagnosis.status === 'pass' || existingDiagnosis.status === 'parked') ? existingDiagnosis : {
|
|
2231
|
-
microtaskId: diagnosisId,
|
|
2232
|
-
lane: 'build',
|
|
2233
|
-
type: 'diagnosis_gate',
|
|
2234
|
-
status: (existingDiagnosis === null || existingDiagnosis === void 0 ? void 0 : existingDiagnosis.status) || 'pending',
|
|
2235
|
-
objective: diagnosisObjective,
|
|
2236
|
-
targetFiles: [],
|
|
2237
|
-
contextRefs: ['scope_digest', 'support_context', 'similar_tickets', 'similar_commits'],
|
|
2238
|
-
selfGate: 'Read-only diagnosis only: reproduce or explicitly classify the issue, accept one falsifiable root-cause hypothesis, reject alternatives, identify the failing path, cap owner_files, and define before/action/after business proof.',
|
|
2239
|
-
acceptanceProof: 'Valid ResolveIOSupportDiagnosisGate JSON with issue_case, issue_class, accepted_hypothesis, rejected_alternatives, failing_path, owner_files, proof_plan, evidence, and status=passed.',
|
|
2240
|
-
threadKey: input.buildThreadKey,
|
|
2241
|
-
promptTokenEstimate: existingDiagnosis === null || existingDiagnosis === void 0 ? void 0 : existingDiagnosis.promptTokenEstimate,
|
|
2242
|
-
attempts: (existingDiagnosis === null || existingDiagnosis === void 0 ? void 0 : existingDiagnosis.attempts) || 0,
|
|
2243
|
-
dependsOn: [],
|
|
2244
|
-
parentScopeId: stableIdFromText('scope', diagnosisObjective),
|
|
2245
|
-
blocker: existingDiagnosis === null || existingDiagnosis === void 0 ? void 0 : existingDiagnosis.blocker,
|
|
2246
|
-
createdAt: (existingDiagnosis === null || existingDiagnosis === void 0 ? void 0 : existingDiagnosis.createdAt) || now,
|
|
2247
|
-
updatedAt: (existingDiagnosis === null || existingDiagnosis === void 0 ? void 0 : existingDiagnosis.updatedAt) || now
|
|
2248
|
-
});
|
|
2249
|
-
sourceRequirements.forEach(function (requirement, index) {
|
|
2250
|
-
var objective = cleanText(requirement, 240);
|
|
2251
|
-
if (!objective) {
|
|
2252
|
-
return;
|
|
2253
|
-
}
|
|
2254
|
-
var existingCompleted = completedByObjective.get(objective.toLowerCase());
|
|
2255
|
-
var buildId = stableIdFromText("build-".concat(index + 1), objective);
|
|
2256
|
-
var qaId = stableIdFromText("qa-".concat(index + 1), objective);
|
|
2257
|
-
ledger.push(existingCompleted && existingCompleted.lane === 'build' ? existingCompleted : {
|
|
2258
|
-
microtaskId: buildId,
|
|
2259
|
-
lane: 'build',
|
|
2260
|
-
type: 'build_repair',
|
|
2261
|
-
status: 'pending',
|
|
2262
|
-
objective: objective,
|
|
2263
|
-
targetFiles: [],
|
|
2264
|
-
contextRefs: ['scope_digest'],
|
|
2265
|
-
selfGate: 'Run the smallest compile/type/unit check that proves this one behavior.',
|
|
2266
|
-
acceptanceProof: 'Concrete code/data proof for this behavior, with changed files listed.',
|
|
2267
|
-
threadKey: input.buildThreadKey,
|
|
2268
|
-
attempts: 0,
|
|
2269
|
-
dependsOn: [diagnosisId],
|
|
2270
|
-
parentScopeId: stableIdFromText('scope', objective),
|
|
2271
|
-
createdAt: now,
|
|
2272
|
-
updatedAt: now
|
|
2273
|
-
});
|
|
2274
|
-
ledger.push({
|
|
2275
|
-
microtaskId: qaId,
|
|
2276
|
-
lane: 'qa',
|
|
2277
|
-
type: 'qa_row',
|
|
2278
|
-
status: 'pending',
|
|
2279
|
-
objective: "QA proof for: ".concat(objective),
|
|
2280
|
-
targetFiles: [],
|
|
2281
|
-
contextRefs: ['scope_digest', buildId],
|
|
2282
|
-
selfGate: 'Drive this one customer-facing workflow row in browser/localhost and capture one captioned proof artifact.',
|
|
2283
|
-
acceptanceProof: 'QA matrix row pass with route/data assertion, screenshot/caption artifact, and persisted before/after row/count/value proof for data-changing workflows.',
|
|
2284
|
-
threadKey: input.qaThreadKey,
|
|
2285
|
-
attempts: 0,
|
|
2286
|
-
dependsOn: [diagnosisId, buildId],
|
|
2287
|
-
parentScopeId: stableIdFromText('scope', objective),
|
|
2288
|
-
createdAt: now,
|
|
2289
|
-
updatedAt: now
|
|
2290
|
-
});
|
|
2291
|
-
});
|
|
2292
|
-
return ledger.length ? ledger : existing.slice(-80);
|
|
2293
|
-
}
|
|
2294
|
-
function selectResolveIOSupportV5ActiveMicrotask(ledger, preferredId) {
|
|
2295
|
-
if (ledger === void 0) { ledger = []; }
|
|
2296
|
-
var byPreferred = preferredId ? ledger.find(function (task) { return task.microtaskId === preferredId && !['pass', 'parked'].includes(task.status); }) : undefined;
|
|
2297
|
-
if (byPreferred) {
|
|
2298
|
-
return byPreferred;
|
|
2299
|
-
}
|
|
2300
|
-
return ledger.find(function (task) { return task.status === 'needs_repair'; })
|
|
2301
|
-
|| ledger.find(function (task) { return task.status === 'in_progress'; })
|
|
2302
|
-
|| ledger.find(function (task) { return task.type === 'diagnosis_gate' && task.status === 'pending'; })
|
|
2303
|
-
|| ledger.find(function (task) { return task.lane === 'build' && /repair/i.test(String(task.type || '')) && task.status === 'pending'; })
|
|
2304
|
-
|| ledger.find(function (task) { return task.status === 'pending'; })
|
|
2305
|
-
|| ledger.find(function (task) { return task.status === 'blocked'; });
|
|
2306
|
-
}
|
|
2307
|
-
function initializeResolveIOSupportV5State(input) {
|
|
2308
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
2309
|
-
var now = isoNow(input.now);
|
|
2310
|
-
var existing = input.existing || {};
|
|
2311
|
-
var existingSupervisor = existing.supportV5SupervisorState;
|
|
2312
|
-
var existingLaneMemory = existing.supportV5LaneMemory || {};
|
|
2313
|
-
var scope = cleanList(input.approvedScopeRequirements, 24, 240).join(' | ')
|
|
2314
|
-
|| cleanText(input.description, 1000)
|
|
2315
|
-
|| cleanText(input.title, 300);
|
|
2316
|
-
var ticketLabel = cleanText(input.ticketNumber || input.ticketId || input.jobId, 120);
|
|
2317
|
-
var buildThreadKey = cleanText(input.buildThreadKey || ((_a = existingLaneMemory.build) === null || _a === void 0 ? void 0 : _a.threadKey) || "support:".concat(input.ticketId || input.jobId, ":job:").concat(input.jobId, ":build"), 240);
|
|
2318
|
-
var qaThreadKey = cleanText(input.qaThreadKey || ((_b = existingLaneMemory.qa) === null || _b === void 0 ? void 0 : _b.threadKey) || "support:".concat(input.ticketId || input.jobId, ":job:").concat(input.jobId, ":qa"), 240);
|
|
2319
|
-
var budget = buildResolveIOSupportV5Budget(existing.supportV5Budget);
|
|
2320
|
-
var existingDiagnosisGate = normalizeResolveIOSupportDiagnosisGate(existing.supportV5DiagnosisGate);
|
|
2321
|
-
var diagnosisValidation = validateResolveIOSupportDiagnosisGate(existingDiagnosisGate);
|
|
2322
|
-
var scopeDigest = cleanText(existing.supportV5ScopeDigest, 4000) || buildResolveIOSupportV5ScopeDigest({
|
|
2323
|
-
goal: (existingSupervisor === null || existingSupervisor === void 0 ? void 0 : existingSupervisor.currentGoal) || "Resolve support ticket ".concat(ticketLabel),
|
|
2324
|
-
approvedScope: scope,
|
|
2325
|
-
prBranch: input.prBranch || (existingSupervisor === null || existingSupervisor === void 0 ? void 0 : existingSupervisor.prBranch) || ''
|
|
2326
|
-
});
|
|
2327
|
-
var ledger = buildResolveIOSupportV5MicrotaskLedger({
|
|
2328
|
-
scopeDigest: scopeDigest,
|
|
2329
|
-
requirements: cleanList(input.approvedScopeRequirements, 30, 240),
|
|
2330
|
-
buildThreadKey: buildThreadKey,
|
|
2331
|
-
qaThreadKey: qaThreadKey,
|
|
2332
|
-
now: now,
|
|
2333
|
-
existing: existing.supportV5MicrotaskLedger
|
|
2334
|
-
});
|
|
2335
|
-
var activeMicrotask = selectResolveIOSupportV5ActiveMicrotask(ledger, existing.supportV5ActiveMicrotaskId);
|
|
2336
|
-
var initialized = {
|
|
2337
|
-
supportWorkflowVersion: 'v5',
|
|
2338
|
-
supportV5SupervisorState: {
|
|
2339
|
-
version: 'v5',
|
|
2340
|
-
status: (existingSupervisor === null || existingSupervisor === void 0 ? void 0 : existingSupervisor.status) || 'active',
|
|
2341
|
-
currentGoal: (existingSupervisor === null || existingSupervisor === void 0 ? void 0 : existingSupervisor.currentGoal) || "Resolve support ticket ".concat(ticketLabel),
|
|
2342
|
-
approvedScope: (existingSupervisor === null || existingSupervisor === void 0 ? void 0 : existingSupervisor.approvedScope) || scope,
|
|
2343
|
-
prBranch: cleanText(input.prBranch || (existingSupervisor === null || existingSupervisor === void 0 ? void 0 : existingSupervisor.prBranch) || '', 240),
|
|
2344
|
-
activeStep: (existingSupervisor === null || existingSupervisor === void 0 ? void 0 : existingSupervisor.activeStep) || (diagnosisValidation.valid ? 'compile_check' : 'diagnosis_gate'),
|
|
2345
|
-
activeBlocker: (existingSupervisor === null || existingSupervisor === void 0 ? void 0 : existingSupervisor.activeBlocker) || (diagnosisValidation.valid ? '' : 'SupportDiagnosisGate required before product-code repair.'),
|
|
2346
|
-
lastGoodCheckpoint: (existingSupervisor === null || existingSupervisor === void 0 ? void 0 : existingSupervisor.lastGoodCheckpoint) || 'v5_initialized',
|
|
2347
|
-
currentQaRow: existingSupervisor === null || existingSupervisor === void 0 ? void 0 : existingSupervisor.currentQaRow,
|
|
2348
|
-
processLease: input.processLease || (existingSupervisor === null || existingSupervisor === void 0 ? void 0 : existingSupervisor.processLease),
|
|
2349
|
-
artifactLinks: cleanList(existingSupervisor === null || existingSupervisor === void 0 ? void 0 : existingSupervisor.artifactLinks, 40, 500),
|
|
2350
|
-
noEmailUnlessApproved: true,
|
|
2351
|
-
updatedAt: now
|
|
2352
|
-
},
|
|
2353
|
-
supportV5DiagnosisGate: diagnosisValidation.valid ? diagnosisValidation.normalized : existingDiagnosisGate,
|
|
2354
|
-
supportV5DiagnosisEvidencePack: existing.supportV5DiagnosisEvidencePack || existing.support_v5_diagnosis_evidence_pack,
|
|
2355
|
-
supportV5LaneMemory: {
|
|
2356
|
-
build: {
|
|
2357
|
-
lane: 'build',
|
|
2358
|
-
model: ((_c = existingLaneMemory.build) === null || _c === void 0 ? void 0 : _c.model) || 'gpt-5.3-codex',
|
|
2359
|
-
threadKey: buildThreadKey,
|
|
2360
|
-
scopeSummary: ((_d = existingLaneMemory.build) === null || _d === void 0 ? void 0 : _d.scopeSummary) || scope,
|
|
2361
|
-
activeBlocker: ((_e = existingLaneMemory.build) === null || _e === void 0 ? void 0 : _e.activeBlocker) || '',
|
|
2362
|
-
activeQaRow: (_f = existingLaneMemory.build) === null || _f === void 0 ? void 0 : _f.activeQaRow,
|
|
2363
|
-
changedFiles: cleanList((_g = existingLaneMemory.build) === null || _g === void 0 ? void 0 : _g.changedFiles, 80, 500),
|
|
2364
|
-
artifactPaths: cleanList((_h = existingLaneMemory.build) === null || _h === void 0 ? void 0 : _h.artifactPaths, 80, 500),
|
|
2365
|
-
latestPromptTokenEstimate: Number(((_j = existingLaneMemory.build) === null || _j === void 0 ? void 0 : _j.latestPromptTokenEstimate) || 0) || undefined,
|
|
2366
|
-
updatedAt: ((_k = existingLaneMemory.build) === null || _k === void 0 ? void 0 : _k.updatedAt) || now
|
|
2367
|
-
},
|
|
2368
|
-
qa: {
|
|
2369
|
-
lane: 'qa',
|
|
2370
|
-
model: ((_l = existingLaneMemory.qa) === null || _l === void 0 ? void 0 : _l.model) || 'gpt-5.4-mini',
|
|
2371
|
-
threadKey: qaThreadKey,
|
|
2372
|
-
scopeSummary: ((_m = existingLaneMemory.qa) === null || _m === void 0 ? void 0 : _m.scopeSummary) || scope,
|
|
2373
|
-
activeBlocker: ((_o = existingLaneMemory.qa) === null || _o === void 0 ? void 0 : _o.activeBlocker) || '',
|
|
2374
|
-
activeQaRow: (_p = existingLaneMemory.qa) === null || _p === void 0 ? void 0 : _p.activeQaRow,
|
|
2375
|
-
changedFiles: cleanList((_q = existingLaneMemory.qa) === null || _q === void 0 ? void 0 : _q.changedFiles, 80, 500),
|
|
2376
|
-
artifactPaths: cleanList((_r = existingLaneMemory.qa) === null || _r === void 0 ? void 0 : _r.artifactPaths, 80, 500),
|
|
2377
|
-
latestPromptTokenEstimate: Number(((_s = existingLaneMemory.qa) === null || _s === void 0 ? void 0 : _s.latestPromptTokenEstimate) || 0) || undefined,
|
|
2378
|
-
updatedAt: ((_t = existingLaneMemory.qa) === null || _t === void 0 ? void 0 : _t.updatedAt) || now
|
|
2379
|
-
}
|
|
2380
|
-
},
|
|
2381
|
-
supportV5StepHistory: Array.isArray(existing.supportV5StepHistory)
|
|
2382
|
-
? existing.supportV5StepHistory.slice(-80)
|
|
2383
|
-
: [],
|
|
2384
|
-
supportV5Budget: budget,
|
|
2385
|
-
supportV5RunnerIncidents: Array.isArray(existing.supportV5RunnerIncidents)
|
|
2386
|
-
? existing.supportV5RunnerIncidents.slice(-80)
|
|
2387
|
-
: [],
|
|
2388
|
-
supportV5MicrotaskLedger: ledger,
|
|
2389
|
-
supportV5ActiveMicrotaskId: diagnosisValidation.valid
|
|
2390
|
-
? activeMicrotask === null || activeMicrotask === void 0 ? void 0 : activeMicrotask.microtaskId
|
|
2391
|
-
: ((_u = ledger.find(function (task) { return task.type === 'diagnosis_gate' && !['pass', 'parked'].includes(task.status); })) === null || _u === void 0 ? void 0 : _u.microtaskId) || (activeMicrotask === null || activeMicrotask === void 0 ? void 0 : activeMicrotask.microtaskId),
|
|
2392
|
-
supportV5ScopeDigest: scopeDigest,
|
|
2393
|
-
supportV5MicrotaskUsageHistory: Array.isArray(existing.supportV5MicrotaskUsageHistory)
|
|
2394
|
-
? existing.supportV5MicrotaskUsageHistory.slice(-200)
|
|
2395
|
-
: [],
|
|
2396
|
-
supportV5FailureFingerprints: Array.isArray(existing.supportV5FailureFingerprints)
|
|
2397
|
-
? existing.supportV5FailureFingerprints.slice(-200)
|
|
2398
|
-
: [],
|
|
2399
|
-
supportV5RecoveryPlan: existing.supportV5RecoveryPlan,
|
|
2400
|
-
supportV5RecoveryCheckpoint: existing.supportV5RecoveryCheckpoint,
|
|
2401
|
-
supportV5RecoveryEvidenceProbe: existing.supportV5RecoveryEvidenceProbe,
|
|
2402
|
-
supportV5RecoveryAction: existing.supportV5RecoveryAction,
|
|
2403
|
-
supportV5RecoveryDispatchHistory: Array.isArray(existing.supportV5RecoveryDispatchHistory)
|
|
2404
|
-
? existing.supportV5RecoveryDispatchHistory.slice(-50)
|
|
2405
|
-
: [],
|
|
2406
|
-
supportV5RecoveryDirective: existing.supportV5RecoveryDirective
|
|
2407
|
-
};
|
|
2408
|
-
return diagnosisValidation.valid && diagnosisValidation.normalized
|
|
2409
|
-
? applyResolveIOSupportDiagnosisGateToMicrotasks(initialized, diagnosisValidation.normalized)
|
|
2410
|
-
: initialized;
|
|
2411
|
-
}
|
|
2412
|
-
function recordResolveIOSupportV5Step(bundle, step) {
|
|
2413
|
-
var _a, _b, _c, _d;
|
|
2414
|
-
var now = isoNow(step.now);
|
|
2415
|
-
var promptTokens = Math.max(0, Number(step.promptTokenEstimate || 0) || 0);
|
|
2416
|
-
var runtimeMs = Math.max(0, Number(step.runtimeMs || 0) || 0);
|
|
2417
|
-
var microtaskId = cleanText(step.microtaskId || bundle.supportV5ActiveMicrotaskId, 160);
|
|
2418
|
-
var normalizedDiagnosisGate = step.diagnosisGate
|
|
2419
|
-
? normalizeResolveIOSupportDiagnosisGate(step.diagnosisGate, now)
|
|
2420
|
-
: undefined;
|
|
2421
|
-
var blockerFingerprint = step.blocker || step.summary
|
|
2422
|
-
? fingerprintResolveIOSupportV5Blocker(step.blocker || step.summary || '')
|
|
2423
|
-
: undefined;
|
|
2424
|
-
var evidenceHash = cleanText(step.evidenceHash, 80)
|
|
2425
|
-
|| (((_a = step.artifactPaths) === null || _a === void 0 ? void 0 : _a.length) || step.blocker || step.summary
|
|
2426
|
-
? hashResolveIOSupportV5Evidence(((_b = step.artifactPaths) === null || _b === void 0 ? void 0 : _b.length) ? step.artifactPaths : "".concat(step.blocker || '', "\n").concat(step.summary || ''))
|
|
2427
|
-
: (0, ai_runner_manager_policy_1.hashResolveIOAIManagerEvidence)({
|
|
2428
|
-
failureClass: step.failureClass,
|
|
2429
|
-
blocker: step.blocker,
|
|
2430
|
-
summary: step.summary,
|
|
2431
|
-
changedFiles: step.changedFiles,
|
|
2432
|
-
artifactPaths: step.artifactPaths
|
|
2433
|
-
}));
|
|
2434
|
-
var record = __assign(__assign({}, (microtaskId ? { microtaskId: microtaskId } : {})), { stepType: step.stepType, outcome: step.outcome, lane: step.lane, model: cleanText(step.model, 80), threadKey: cleanText(step.threadKey, 240), promptTokenEstimate: promptTokens || undefined, runtimeMs: runtimeMs || undefined, summary: cleanText(step.summary || step.blocker || step.outcome, 1200), blocker: cleanText(step.blocker, 1200), changedFiles: cleanList(step.changedFiles, 80, 500), artifactPaths: cleanList(step.artifactPaths, 80, 500), diagnosisGate: normalizedDiagnosisGate, failureClass: cleanText(step.failureClass, 80) || undefined, blockerFingerprint: blockerFingerprint, evidenceHash: evidenceHash, recordedAt: now });
|
|
2435
|
-
var diagnosisGate = normalizedDiagnosisGate || bundle.supportV5DiagnosisGate;
|
|
2436
|
-
var laneMemory = __assign({}, bundle.supportV5LaneMemory);
|
|
2437
|
-
if (step.lane === 'build' || step.lane === 'qa') {
|
|
2438
|
-
var previous = laneMemory[step.lane];
|
|
2439
|
-
laneMemory[step.lane] = __assign(__assign({}, previous), { activeBlocker: record.blocker || previous.activeBlocker || '', activeQaRow: step.activeQaRow || previous.activeQaRow, changedFiles: ((_c = record.changedFiles) === null || _c === void 0 ? void 0 : _c.length) ? record.changedFiles : previous.changedFiles, artifactPaths: ((_d = record.artifactPaths) === null || _d === void 0 ? void 0 : _d.length) ? record.artifactPaths : previous.artifactPaths, latestPromptTokenEstimate: promptTokens || previous.latestPromptTokenEstimate, updatedAt: now });
|
|
2440
|
-
}
|
|
2441
|
-
var supervisor = __assign(__assign({}, bundle.supportV5SupervisorState), { status: step.outcome === 'ready_for_merge' ? 'complete' : (step.outcome === 'park_manual' || step.outcome === 'budget_stop' ? 'parked' : 'active'), activeStep: step.stepType, activeBlocker: record.blocker || '', currentQaRow: step.activeQaRow || bundle.supportV5SupervisorState.currentQaRow, lastGoodCheckpoint: step.outcome === 'pass' || step.outcome === 'ready_for_merge'
|
|
2442
|
-
? step.stepType
|
|
2443
|
-
: bundle.supportV5SupervisorState.lastGoodCheckpoint, artifactLinks: Array.from(new Set(__spreadArray(__spreadArray([], __read(bundle.supportV5SupervisorState.artifactLinks), false), __read((record.artifactPaths || [])), false))).slice(-80), updatedAt: now });
|
|
2444
|
-
var ledger = (bundle.supportV5MicrotaskLedger || []).map(function (task) {
|
|
2445
|
-
if (task.microtaskId !== bundle.supportV5ActiveMicrotaskId) {
|
|
2446
|
-
return task;
|
|
2447
|
-
}
|
|
2448
|
-
var status = step.outcome === 'pass' || step.outcome === 'ready_for_merge'
|
|
2449
|
-
? 'pass'
|
|
2450
|
-
: step.outcome === 'park_manual' || step.outcome === 'budget_stop'
|
|
2451
|
-
? 'parked'
|
|
2452
|
-
: step.outcome === 'needs_repair' || step.outcome === 'retry_same_step'
|
|
2453
|
-
? 'needs_repair'
|
|
2454
|
-
: 'in_progress';
|
|
2455
|
-
return __assign(__assign({}, task), { status: status, blocker: record.blocker || task.blocker, promptTokenEstimate: promptTokens || task.promptTokenEstimate, attempts: task.attempts + (step.outcome === 'pass' || step.outcome === 'ready_for_merge' ? 0 : 1), updatedAt: now });
|
|
2456
|
-
});
|
|
2457
|
-
var failureFingerprint = record.failureClass && record.blockerFingerprint && record.evidenceHash
|
|
2458
|
-
? {
|
|
2459
|
-
stepType: record.stepType,
|
|
2460
|
-
failureClass: cleanText(record.failureClass, 80),
|
|
2461
|
-
blockerFingerprint: record.blockerFingerprint,
|
|
2462
|
-
evidenceHash: record.evidenceHash,
|
|
2463
|
-
recordedAt: now
|
|
2464
|
-
}
|
|
2465
|
-
: undefined;
|
|
2466
|
-
var managerDecision = (0, ai_runner_manager_policy_1.decideResolveIOAIManagerPolicy)({
|
|
2467
|
-
history: __spreadArray(__spreadArray([], __read(bundle.supportV5StepHistory), false), [record], false),
|
|
2468
|
-
current: record,
|
|
2469
|
-
maxSameFailureRepeats: buildResolveIOSupportV5Budget(bundle.supportV5Budget).maxRepeatedNoProgress,
|
|
2470
|
-
maxPingPongTransitions: 3,
|
|
2471
|
-
infraFailureClasses: ['infra', 'compile']
|
|
2472
|
-
});
|
|
2473
|
-
var previousRecord = bundle.supportV5StepHistory[bundle.supportV5StepHistory.length - 1];
|
|
2474
|
-
var nextLoopCount = managerDecision.loopBudgetShouldReset
|
|
2475
|
-
|| (previousRecord === null || previousRecord === void 0 ? void 0 : previousRecord.failureClass) !== record.failureClass
|
|
2476
|
-
|| (previousRecord === null || previousRecord === void 0 ? void 0 : previousRecord.blockerFingerprint) !== record.blockerFingerprint
|
|
2477
|
-
|| (previousRecord === null || previousRecord === void 0 ? void 0 : previousRecord.evidenceHash) !== record.evidenceHash
|
|
2478
|
-
? 1
|
|
2479
|
-
: bundle.supportV5Budget.loopCount + 1;
|
|
2480
|
-
var nextMicrotask = selectResolveIOSupportV5ActiveMicrotask(ledger, bundle.supportV5ActiveMicrotaskId);
|
|
2481
|
-
var nextBundle = __assign(__assign({}, bundle), { supportV5SupervisorState: supervisor, supportV5DiagnosisGate: diagnosisGate, supportV5LaneMemory: laneMemory, supportV5StepHistory: __spreadArray(__spreadArray([], __read(bundle.supportV5StepHistory), false), [record], false).slice(-100), supportV5Budget: __assign(__assign({}, bundle.supportV5Budget), { totalPromptTokenEstimate: bundle.supportV5Budget.totalPromptTokenEstimate + promptTokens, totalRuntimeMs: bundle.supportV5Budget.totalRuntimeMs + runtimeMs, loopCount: nextLoopCount }), supportV5MicrotaskLedger: ledger, supportV5ActiveMicrotaskId: nextMicrotask === null || nextMicrotask === void 0 ? void 0 : nextMicrotask.microtaskId, supportV5MicrotaskUsageHistory: bundle.supportV5MicrotaskUsageHistory || [], supportV5FailureFingerprints: failureFingerprint
|
|
2482
|
-
? __spreadArray(__spreadArray([], __read((bundle.supportV5FailureFingerprints || [])), false), [failureFingerprint], false).slice(-200)
|
|
2483
|
-
: (bundle.supportV5FailureFingerprints || []), supportV5RecoveryPlan: managerDecision.recoveryPlan, supportV5RecoveryCheckpoint: managerDecision.recoveryCheckpoint, supportV5RecoveryEvidenceProbe: managerDecision.recoveryEvidenceProbe, supportV5RecoveryAction: managerDecision.recoveryAction });
|
|
2484
|
-
if (normalizedDiagnosisGate && validateResolveIOSupportDiagnosisGate(normalizedDiagnosisGate).valid) {
|
|
2485
|
-
return applyResolveIOSupportDiagnosisGateToMicrotasks(nextBundle, normalizedDiagnosisGate);
|
|
2486
|
-
}
|
|
2487
|
-
return nextBundle;
|
|
2488
|
-
}
|
|
2489
|
-
function recordResolveIOSupportV5MicrotaskUsage(bundle, usage) {
|
|
2490
|
-
var record = __assign(__assign({}, usage), { microtaskId: cleanText(usage.microtaskId, 160), threadKey: cleanText(usage.threadKey, 240), model: cleanText(usage.model, 80), promptTokenEstimate: Math.max(0, Number(usage.promptTokenEstimate || 0) || 0), promptSections: Array.isArray(usage.promptSections)
|
|
2491
|
-
? usage.promptSections.map(function (section) { return ({
|
|
2492
|
-
name: cleanText(section.name, 120),
|
|
2493
|
-
tokenEstimate: Math.max(0, Number(section.tokenEstimate || 0) || 0)
|
|
2494
|
-
}); }).filter(function (section) { return section.name; })
|
|
2495
|
-
: [], recordedAt: isoNow() });
|
|
2496
|
-
var ledger = (bundle.supportV5MicrotaskLedger || []).map(function (task) { return task.microtaskId === record.microtaskId
|
|
2497
|
-
? __assign(__assign({}, task), { promptTokenEstimate: record.promptTokenEstimate, updatedAt: record.recordedAt }) : task; });
|
|
2498
|
-
return __assign(__assign({}, bundle), { supportV5MicrotaskLedger: ledger, supportV5MicrotaskUsageHistory: __spreadArray(__spreadArray([], __read((bundle.supportV5MicrotaskUsageHistory || [])), false), [
|
|
2499
|
-
record
|
|
2500
|
-
], false).slice(-200) });
|
|
2501
|
-
}
|
|
2502
|
-
function decideResolveIOSupportV5Continuation(bundle) {
|
|
2503
|
-
var history = bundle.supportV5StepHistory || [];
|
|
2504
|
-
var budget = buildResolveIOSupportV5Budget(bundle.supportV5Budget);
|
|
2505
|
-
var last = history[history.length - 1];
|
|
2506
|
-
var activeMicrotaskId = cleanText(bundle.supportV5ActiveMicrotaskId, 160);
|
|
2507
|
-
var blockerFingerprint = fingerprintResolveIOSupportV5Blocker((last === null || last === void 0 ? void 0 : last.blocker) || (last === null || last === void 0 ? void 0 : last.summary) || '');
|
|
2508
|
-
var repeatedNoProgressCount = 0;
|
|
2509
|
-
for (var index = history.length - 1; index >= 0; index -= 1) {
|
|
2510
|
-
var item = history[index];
|
|
2511
|
-
if (activeMicrotaskId && cleanText(item.microtaskId, 160) !== activeMicrotaskId) {
|
|
2512
|
-
continue;
|
|
2513
|
-
}
|
|
2514
|
-
if (item.outcome === 'pass' || item.outcome === 'ready_for_merge') {
|
|
2515
|
-
break;
|
|
2516
|
-
}
|
|
2517
|
-
if (item.stepType !== (last === null || last === void 0 ? void 0 : last.stepType)) {
|
|
2518
|
-
break;
|
|
2519
|
-
}
|
|
2520
|
-
if (fingerprintResolveIOSupportV5Blocker(item.blocker || item.summary || '') === blockerFingerprint) {
|
|
2521
|
-
repeatedNoProgressCount += 1;
|
|
2522
|
-
}
|
|
2523
|
-
}
|
|
2524
|
-
var budgetExceeded = budget.loopCount >= budget.maxLoopsPerTicket
|
|
2525
|
-
|| ((last === null || last === void 0 ? void 0 : last.promptTokenEstimate) || 0) > budget.maxPromptTokensPerNonInitialStep;
|
|
2526
|
-
var repeatedFailure = last ? decideResolveIOSupportV5RepeatedFailureStop({
|
|
2527
|
-
history: history,
|
|
2528
|
-
failureClass: last.failureClass,
|
|
2529
|
-
blocker: last.blocker || last.summary,
|
|
2530
|
-
evidenceHash: last.evidenceHash,
|
|
2531
|
-
changedFiles: last.changedFiles,
|
|
2532
|
-
artifactPaths: last.artifactPaths,
|
|
2533
|
-
limit: budget.maxRepeatedNoProgress,
|
|
2534
|
-
ignoreInfra: true
|
|
2535
|
-
}) : null;
|
|
2536
|
-
var recoveryPlanFor = function (action, reason, extra) {
|
|
2537
|
-
if (extra === void 0) { extra = {}; }
|
|
2538
|
-
return (0, ai_runner_manager_policy_1.buildResolveIOAIManagerRecoveryPlan)(__assign({ action: action, reason: reason, failureClass: last === null || last === void 0 ? void 0 : last.failureClass, lane: (last === null || last === void 0 ? void 0 : last.lane) || 'supervisor', stepType: (last === null || last === void 0 ? void 0 : last.stepType) || bundle.supportV5SupervisorState.activeStep, blocker: (last === null || last === void 0 ? void 0 : last.blocker) || (last === null || last === void 0 ? void 0 : last.summary), changedFiles: last === null || last === void 0 ? void 0 : last.changedFiles, artifactPaths: last === null || last === void 0 ? void 0 : last.artifactPaths, maxSameFailureRepeats: budget.maxRepeatedNoProgress }, extra));
|
|
2539
|
-
};
|
|
2540
|
-
var recoveryCheckpointFor = function (recoveryPlan) { return (0, ai_runner_manager_policy_1.buildResolveIOAIManagerRecoveryCheckpoint)({
|
|
2541
|
-
plan: recoveryPlan,
|
|
2542
|
-
current: last
|
|
2543
|
-
}); };
|
|
2544
|
-
var recoveryFieldsFor = function (recoveryPlan) {
|
|
2545
|
-
var recoveryCheckpoint = recoveryCheckpointFor(recoveryPlan);
|
|
2546
|
-
var recoveryEvidenceProbe = (0, ai_runner_manager_policy_1.buildResolveIOAIManagerRecoveryEvidenceProbe)({
|
|
2547
|
-
checkpoint: recoveryCheckpoint,
|
|
2548
|
-
current: last
|
|
2549
|
-
});
|
|
2550
|
-
return {
|
|
2551
|
-
recoveryPlan: recoveryPlan,
|
|
2552
|
-
recoveryCheckpoint: recoveryCheckpoint,
|
|
2553
|
-
recoveryEvidenceProbe: recoveryEvidenceProbe,
|
|
2554
|
-
recoveryAction: (0, ai_runner_manager_policy_1.buildResolveIOAIManagerRecoveryActionPacket)({
|
|
2555
|
-
plan: recoveryPlan,
|
|
2556
|
-
checkpoint: recoveryCheckpoint,
|
|
2557
|
-
probe: recoveryEvidenceProbe,
|
|
2558
|
-
current: last
|
|
2559
|
-
})
|
|
2560
|
-
};
|
|
2561
|
-
};
|
|
2562
|
-
if (budgetExceeded) {
|
|
2563
|
-
var recoveryPlan_5 = recoveryPlanFor('manual_handoff', 'support_v5_budget_guard', {
|
|
2564
|
-
productRepairFailure: false
|
|
2565
|
-
});
|
|
2566
|
-
return __assign({ action: 'park', reason: 'support_v5_budget_guard', nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || 'cleanup', repeatedNoProgressCount: repeatedNoProgressCount, budgetExceeded: budgetExceeded }, recoveryFieldsFor(recoveryPlan_5));
|
|
2567
|
-
}
|
|
2568
|
-
var lastFailureClass = cleanText(last === null || last === void 0 ? void 0 : last.failureClass, 80).toLowerCase();
|
|
2569
|
-
var materialEvidenceRetryAllowed = (repeatedFailure === null || repeatedFailure === void 0 ? void 0 : repeatedFailure.shouldStop) === false
|
|
2570
|
-
&& repeatedFailure.newEvidence === true
|
|
2571
|
-
&& repeatedFailure.materialEvidence === true;
|
|
2572
|
-
if (repeatedNoProgressCount > budget.maxRepeatedNoProgress && /^(infra|compile)$/.test(lastFailureClass)) {
|
|
2573
|
-
var recoveryPlan_6 = recoveryPlanFor('retry_infra', 'support_v5_infra_or_compile_repair_required', {
|
|
2574
|
-
failureClass: lastFailureClass,
|
|
2575
|
-
productRepairFailure: false
|
|
2576
|
-
});
|
|
2577
|
-
return __assign({ action: 'continue', reason: 'support_v5_infra_or_compile_repair_required', nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || 'compile_check', repeatedNoProgressCount: repeatedNoProgressCount, budgetExceeded: budgetExceeded }, recoveryFieldsFor(recoveryPlan_6));
|
|
2578
|
-
}
|
|
2579
|
-
if (repeatedFailure === null || repeatedFailure === void 0 ? void 0 : repeatedFailure.shouldStop) {
|
|
2580
|
-
var recoveryPlan_7 = recoveryPlanFor(repeatedFailure.reason === 'support_v5_ping_pong_failure_loop' ? 'park_ping_pong' : 'park_repeated_failure', repeatedFailure.reason, {
|
|
2581
|
-
failureClass: repeatedFailure.failureClass,
|
|
2582
|
-
productRepairFailure: true
|
|
2583
|
-
});
|
|
2584
|
-
return __assign({ action: 'park', reason: repeatedFailure.reason, nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || 'cleanup', repeatedNoProgressCount: repeatedFailure.repeatedCount, budgetExceeded: budgetExceeded }, recoveryFieldsFor(recoveryPlan_7));
|
|
2585
|
-
}
|
|
2586
|
-
if (repeatedNoProgressCount > budget.maxRepeatedNoProgress && !materialEvidenceRetryAllowed) {
|
|
2587
|
-
var recoveryPlan_8 = recoveryPlanFor('park_repeated_failure', 'support_v5_repeated_no_progress', {
|
|
2588
|
-
productRepairFailure: true
|
|
2589
|
-
});
|
|
2590
|
-
return __assign({ action: 'park', reason: 'support_v5_repeated_no_progress', nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || 'cleanup', repeatedNoProgressCount: repeatedNoProgressCount, budgetExceeded: budgetExceeded }, recoveryFieldsFor(recoveryPlan_8));
|
|
2591
|
-
}
|
|
2592
|
-
var recoveryPlan = recoveryPlanFor('continue', 'support_v5_continue');
|
|
2593
|
-
return __assign({ action: 'continue', reason: 'support_v5_continue', nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || bundle.supportV5SupervisorState.activeStep, repeatedNoProgressCount: repeatedNoProgressCount, budgetExceeded: false }, recoveryFieldsFor(recoveryPlan));
|
|
2594
|
-
}
|
|
2595
|
-
function decideResolveIOSupportV5AutonomousNextAction(input) {
|
|
2596
|
-
var _a, _b, _c, _d, _e;
|
|
2597
|
-
var bundle = input.bundle;
|
|
2598
|
-
var activeMicrotask = selectResolveIOSupportV5ActiveMicrotask(bundle.supportV5MicrotaskLedger || [], bundle.supportV5ActiveMicrotaskId);
|
|
2599
|
-
var diagnosisValidation = validateResolveIOSupportDiagnosisGate(bundle.supportV5DiagnosisGate, {
|
|
2600
|
-
maxOwnerFiles: input.maxOwnerFiles
|
|
2601
|
-
});
|
|
2602
|
-
var activeStepType = cleanText((activeMicrotask === null || activeMicrotask === void 0 ? void 0 : activeMicrotask.type) || (!diagnosisValidation.valid ? bundle.supportV5SupervisorState.activeStep : 'cleanup') || 'diagnosis_gate', 80);
|
|
2603
|
-
var repairGate = decideResolveIOSupportV5RepairGate({
|
|
2604
|
-
diagnosisGate: bundle.supportV5DiagnosisGate,
|
|
2605
|
-
activeStepType: activeStepType,
|
|
2606
|
-
changedFiles: input.changedFiles,
|
|
2607
|
-
failureClass: input.failureClass,
|
|
2608
|
-
blocker: input.blocker,
|
|
2609
|
-
evidence: input.evidence,
|
|
2610
|
-
evidenceHash: input.evidenceHash,
|
|
2611
|
-
history: bundle.supportV5StepHistory,
|
|
2612
|
-
artifactPaths: input.artifactPaths,
|
|
2613
|
-
maxOwnerFiles: input.maxOwnerFiles,
|
|
2614
|
-
allowTestsOutsideOwnerFiles: true
|
|
2615
|
-
});
|
|
2616
|
-
var continuation = decideResolveIOSupportV5Continuation(bundle);
|
|
2617
|
-
var customerReplyPolicy = decideResolveIOSupportCustomerReplyPolicy({
|
|
2618
|
-
diagnosisGate: bundle.supportV5DiagnosisGate,
|
|
2619
|
-
outcomeLabel: input.outcomeLabel,
|
|
2620
|
-
confidence: input.confidence,
|
|
2621
|
-
businessAssertionStatus: input.businessAssertionStatus,
|
|
2622
|
-
businessAssertions: input.businessAssertions,
|
|
2623
|
-
businessProofArtifacts: input.businessProofArtifacts,
|
|
2624
|
-
previousProofFingerprint: input.previousProofFingerprint,
|
|
2625
|
-
previousArtifactFingerprint: input.previousArtifactFingerprint,
|
|
2626
|
-
unresolvedBlockers: input.unresolvedBlockers,
|
|
2627
|
-
releaseStatus: input.releaseStatus
|
|
2628
|
-
});
|
|
2629
|
-
var businessProofReadiness = evaluateResolveIOSupportBusinessProofReadiness({
|
|
2630
|
-
diagnosisGate: bundle.supportV5DiagnosisGate,
|
|
2631
|
-
outcomeLabel: input.outcomeLabel,
|
|
2632
|
-
businessAssertionStatus: input.businessAssertionStatus,
|
|
2633
|
-
businessAssertions: input.businessAssertions,
|
|
2634
|
-
businessProofArtifacts: input.businessProofArtifacts,
|
|
2635
|
-
previousProofFingerprint: input.previousProofFingerprint,
|
|
2636
|
-
previousArtifactFingerprint: input.previousArtifactFingerprint
|
|
2637
|
-
});
|
|
2638
|
-
var evidenceFreshness = evaluateResolveIOSupportEvidenceFreshness({
|
|
2639
|
-
history: bundle.supportV5StepHistory,
|
|
2640
|
-
failureClass: input.failureClass,
|
|
2641
|
-
blocker: input.blocker,
|
|
2642
|
-
evidence: input.evidence,
|
|
2643
|
-
evidenceHash: input.evidenceHash,
|
|
2644
|
-
changedFiles: input.changedFiles,
|
|
2645
|
-
artifactPaths: input.artifactPaths || input.businessProofArtifacts,
|
|
2646
|
-
lane: (activeMicrotask === null || activeMicrotask === void 0 ? void 0 : activeMicrotask.lane) || 'supervisor',
|
|
2647
|
-
stepType: activeStepType,
|
|
2648
|
-
limit: buildResolveIOSupportV5Budget(bundle.supportV5Budget).maxRepeatedNoProgress,
|
|
2649
|
-
ignoreInfra: true
|
|
2650
|
-
});
|
|
2651
|
-
var ownerFiles = ((_a = diagnosisValidation.normalized) === null || _a === void 0 ? void 0 : _a.owner_files) || repairGate.ownerFiles || [];
|
|
2652
|
-
var proofContract = (_b = diagnosisValidation.normalized) === null || _b === void 0 ? void 0 : _b.proof_plan.business_proof_contract;
|
|
2653
|
-
var expectedProof = (proofContract === null || proofContract === void 0 ? void 0 : proofContract.data_or_dom_assertion)
|
|
2654
|
-
|| ((_c = diagnosisValidation.normalized) === null || _c === void 0 ? void 0 : _c.proof_plan.business_assertion)
|
|
2655
|
-
|| (activeMicrotask === null || activeMicrotask === void 0 ? void 0 : activeMicrotask.acceptanceProof)
|
|
2656
|
-
|| '';
|
|
2657
|
-
var issueClassProbes = diagnosisValidation.valid && diagnosisValidation.normalized
|
|
2658
|
-
? buildResolveIOSupportIssueClassProbes(diagnosisValidation.normalized)
|
|
2659
|
-
: [];
|
|
2660
|
-
var activeIssueClassProbe = issueClassProbes[0];
|
|
2661
|
-
var issueClassProbeEvidence = activeIssueClassProbe
|
|
2662
|
-
? Array.from(new Set(__spreadArray([
|
|
2663
|
-
"AIQaBusinessAssertion mapped to ".concat(activeIssueClassProbe.issue_class),
|
|
2664
|
-
"state transition: ".concat(activeIssueClassProbe.state_transition.before || 'before', " -> ").concat(activeIssueClassProbe.state_transition.action || activeIssueClassProbe.action, " -> ").concat(activeIssueClassProbe.state_transition.after || 'after')
|
|
2665
|
-
], __read(activeIssueClassProbe.required_artifacts.map(function (artifact) { return "artifact: ".concat(artifact); })), false)))
|
|
2666
|
-
: [];
|
|
2667
|
-
var buildRootCauseReadiness = function (action, reason, fields, primaryCommand, nextCommands, blockers) {
|
|
2668
|
-
var _a;
|
|
2669
|
-
var statusByAction = {
|
|
2670
|
-
run_diagnosis_gate: 'diagnosis_required',
|
|
2671
|
-
ask_customer_clarification: 'customer_clarification_required',
|
|
2672
|
-
repair_infra_only: 'infra_repair_only',
|
|
2673
|
-
revise_diagnosis_scope: 'scope_revision_required',
|
|
2674
|
-
run_owner_scoped_repair: 'owner_scoped_repair_ready',
|
|
2675
|
-
run_business_proof_qa: 'business_proof_required',
|
|
2676
|
-
repair_release_hotfix_first: 'release_hotfix_required',
|
|
2677
|
-
collect_new_evidence: 'collect_new_evidence',
|
|
2678
|
-
draft_customer_reply: 'customer_reply_draft_ready',
|
|
2679
|
-
ready_for_release_gate: 'release_gate_ready',
|
|
2680
|
-
park_manual: 'parked'
|
|
2681
|
-
};
|
|
2682
|
-
var nextGateByStatus = {
|
|
2683
|
-
diagnosis_required: 'diagnosis',
|
|
2684
|
-
customer_clarification_required: 'customer_reply',
|
|
2685
|
-
infra_repair_only: 'infra',
|
|
2686
|
-
scope_revision_required: 'scope',
|
|
2687
|
-
owner_scoped_repair_ready: 'repair',
|
|
2688
|
-
business_proof_required: 'business_proof',
|
|
2689
|
-
release_hotfix_required: 'release',
|
|
2690
|
-
release_gate_ready: 'release',
|
|
2691
|
-
customer_reply_draft_ready: 'customer_reply',
|
|
2692
|
-
collect_new_evidence: 'evidence',
|
|
2693
|
-
parked: 'manual'
|
|
2694
|
-
};
|
|
2695
|
-
var status = statusByAction[action] || 'parked';
|
|
2696
|
-
var diagnosisValid = diagnosisValidation.valid === true;
|
|
2697
|
-
var ownerFilesReady = diagnosisValid && ownerFiles.length > 0;
|
|
2698
|
-
var proofPlanReady = diagnosisValid && !!proofContract;
|
|
2699
|
-
var rootCauseFirstSatisfied = diagnosisValid && ownerFilesReady && proofPlanReady;
|
|
2700
|
-
var sameFailureParked = evidenceFreshness.mustCollectNewEvidence === true
|
|
2701
|
-
|| (action === 'collect_new_evidence' && /repeated|no_progress|ping_pong|same failure|same evidence/i.test(reason));
|
|
2702
|
-
return {
|
|
2703
|
-
status: status,
|
|
2704
|
-
nextGate: nextGateByStatus[status],
|
|
2705
|
-
nextCommand: primaryCommand || nextCommands[0] || action,
|
|
2706
|
-
rootCauseFirstSatisfied: rootCauseFirstSatisfied,
|
|
2707
|
-
diagnosisValid: diagnosisValid,
|
|
2708
|
-
ownerFilesReady: ownerFilesReady,
|
|
2709
|
-
proofPlanReady: proofPlanReady,
|
|
2710
|
-
businessProofReady: businessProofReadiness.ready === true,
|
|
2711
|
-
infraOnly: action === 'repair_infra_only',
|
|
2712
|
-
sameFailureParked: sameFailureParked,
|
|
2713
|
-
canEditProductCode: fields.canEditProductCode === true && rootCauseFirstSatisfied,
|
|
2714
|
-
canRunIssueClassProbe: rootCauseFirstSatisfied && (action === 'run_business_proof_qa' || status === 'business_proof_required'),
|
|
2715
|
-
canRunBusinessProofQa: rootCauseFirstSatisfied && (action === 'run_business_proof_qa' || !businessProofReadiness.ready),
|
|
2716
|
-
canRelease: action === 'ready_for_release_gate' && businessProofReadiness.ready === true,
|
|
2717
|
-
canDraftCustomerReply: (action === 'draft_customer_reply' && businessProofReadiness.ready === true)
|
|
2718
|
-
|| action === 'ask_customer_clarification',
|
|
2719
|
-
requiresHumanDecision: action === 'park_manual' || fields.canRunAutonomously !== true,
|
|
2720
|
-
reason: reason,
|
|
2721
|
-
blockers: blockers,
|
|
2722
|
-
ownerFiles: ownerFiles,
|
|
2723
|
-
issueClass: ((_a = diagnosisValidation.normalized) === null || _a === void 0 ? void 0 : _a.issue_class) || repairGate.issueClass,
|
|
2724
|
-
expectedProof: expectedProof,
|
|
2725
|
-
issueClassProbes: issueClassProbes,
|
|
2726
|
-
businessProofStatus: businessProofReadiness.status,
|
|
2727
|
-
proofFingerprint: businessProofReadiness.proofFingerprint,
|
|
2728
|
-
artifactFingerprint: businessProofReadiness.artifactFingerprint,
|
|
2729
|
-
proofFreshness: businessProofReadiness.proofFreshness
|
|
2730
|
-
};
|
|
2731
|
-
};
|
|
2732
|
-
var nextActionExpectedTransition = function (action, primaryCommand) {
|
|
2733
|
-
if (action === 'run_diagnosis_gate') {
|
|
2734
|
-
return 'SupportDiagnosisGate changes from missing/incomplete to passed, blocked with one clarification question, or rejected with explicit blockers; no source files are edited.';
|
|
2735
|
-
}
|
|
2736
|
-
if (action === 'ask_customer_clarification') {
|
|
2737
|
-
return 'One customer clarification question is prepared for human review and the ticket parks until the missing reproduction/account context is supplied.';
|
|
2738
|
-
}
|
|
2739
|
-
if (action === 'repair_infra_only') {
|
|
2740
|
-
return 'Infra/preflight evidence changes or passes without charging the failure as product-code repair.';
|
|
2741
|
-
}
|
|
2742
|
-
if (action === 'revise_diagnosis_scope') {
|
|
2743
|
-
return 'SupportDiagnosisGate owner_files, failing_path, and proof_plan are revised together with new evidence before any broader edit.';
|
|
2744
|
-
}
|
|
2745
|
-
if (action === 'run_owner_scoped_repair') {
|
|
2746
|
-
return 'Only diagnosis owner_files change, a compile/unit gate is recorded, and the next state is business proof QA rather than acceptance.';
|
|
2747
|
-
}
|
|
2748
|
-
if (action === 'run_business_proof_qa') {
|
|
2749
|
-
return 'A fresh AIQaBusinessAssertion maps to the active proof_plan and records before/action/after DOM, data, or Mongo proof.';
|
|
2750
|
-
}
|
|
2751
|
-
if (action === 'repair_release_hotfix_first') {
|
|
2752
|
-
return primaryCommand === 'record_hotfix_evidence'
|
|
2753
|
-
? 'Hotfix evidence is recorded with sourceCommitSha, githubCommitUrl, and passed gitPushStatus before any live backend apply or continuation.'
|
|
2754
|
-
: 'The smallest release/hotfix gate changes state, with duplicate full deploy blocked unless force evidence is explicit.';
|
|
2755
|
-
}
|
|
2756
|
-
if (action === 'ready_for_release_gate') {
|
|
2757
|
-
return 'Release gate records compile, business proof, and deployment readiness without treating route-only evidence as acceptance.';
|
|
2758
|
-
}
|
|
2759
|
-
if (action === 'draft_customer_reply') {
|
|
2760
|
-
return 'A customer resolution draft is prepared from accepted business proof and remains unsent until human approval.';
|
|
2761
|
-
}
|
|
2762
|
-
if (action === 'collect_new_evidence') {
|
|
2763
|
-
return 'The next run records a changed blocker fingerprint, changed evidence hash, fresh artifact path, or explicit business/infra/compile/release proof.';
|
|
2764
|
-
}
|
|
2765
|
-
return 'The runner stays parked until a human changes scope, budget, evidence, or autonomy policy.';
|
|
2766
|
-
};
|
|
2767
|
-
var buildNextActionContract = function (action, label, reason, fields, rootCauseReadiness, continuationProofCheckpoint, primaryCommand, nextCommands, requiredEvidence, forbiddenActions, blockers) {
|
|
2768
|
-
var lane = (fields.lane || (activeMicrotask === null || activeMicrotask === void 0 ? void 0 : activeMicrotask.lane) || 'supervisor');
|
|
2769
|
-
var stepType = (fields.stepType || activeStepType);
|
|
2770
|
-
var liveHotfixBlockedUntilCommit = fields.liveHotfixBlockedUntilCommit === true;
|
|
2771
|
-
var hotfixCommitRequired = action === 'repair_release_hotfix_first'
|
|
2772
|
-
|| liveHotfixBlockedUntilCommit
|
|
2773
|
-
|| fields.canHotfixBackend === true;
|
|
2774
|
-
var requiresHumanApproval = action === 'park_manual'
|
|
2775
|
-
|| action === 'ask_customer_clarification'
|
|
2776
|
-
|| rootCauseReadiness.requiresHumanDecision === true;
|
|
2777
|
-
var safeToAutoRun = fields.canRunAutonomously === true
|
|
2778
|
-
&& !requiresHumanApproval
|
|
2779
|
-
&& (action !== 'run_owner_scoped_repair' || (rootCauseReadiness.rootCauseFirstSatisfied === true && evidenceFreshness.mustCollectNewEvidence !== true))
|
|
2780
|
-
&& (action !== 'repair_release_hotfix_first' || primaryCommand !== 'apply_backend_hotfix_only_after_commit_proof' || liveHotfixBlockedUntilCommit !== true);
|
|
2781
|
-
var costRisk = requiresHumanApproval
|
|
2782
|
-
? 'manual_blocked'
|
|
2783
|
-
: (fields.canHotfixBackend === true || action === 'draft_customer_reply')
|
|
2784
|
-
? 'release_or_customer_send'
|
|
2785
|
-
: fields.canRunModel === true
|
|
2786
|
-
? 'expensive_model'
|
|
2787
|
-
: fields.canRunQa === true
|
|
2788
|
-
? 'small_model_or_qa'
|
|
2789
|
-
: 'free_or_deterministic';
|
|
2790
|
-
var canRunWithoutCodexMonitor = safeToAutoRun
|
|
2791
|
-
&& continuationProofCheckpoint.required === true
|
|
2792
|
-
&& forbiddenActions.length > 0
|
|
2793
|
-
&& (requiredEvidence.length > 0 || action === 'repair_infra_only' || action === 'run_diagnosis_gate');
|
|
2794
|
-
var codexFallbackRequired = !canRunWithoutCodexMonitor && !requiresHumanApproval;
|
|
2795
|
-
var codexFallbackReason = codexFallbackRequired
|
|
2796
|
-
? (blockers[0] || continuationProofCheckpoint.reason || 'next_action_contract_missing_required_evidence')
|
|
2797
|
-
: requiresHumanApproval
|
|
2798
|
-
? 'human_decision_required_not_codex_fallback'
|
|
2799
|
-
: !canRunWithoutCodexMonitor
|
|
2800
|
-
? 'structured_contract_blocks_auto_run_without_requesting_codex_monitor'
|
|
2801
|
-
: 'structured_next_action_contract_allows_manager_execution_without_external_codex_monitor';
|
|
2802
|
-
var preconditions = Array.from(new Set(__spreadArray([
|
|
2803
|
-
action !== 'run_diagnosis_gate' ? 'SupportDiagnosisGate validation checked before action.' : 'Diagnosis is read-only and cannot edit source files.',
|
|
2804
|
-
action === 'run_owner_scoped_repair' ? 'Root-cause-first gate is satisfied and owner_files are the only editable product files.' : '',
|
|
2805
|
-
action === 'run_business_proof_qa' ? 'Business proof QA must use the diagnosis proof_plan and generated issue-class probe.' : '',
|
|
2806
|
-
action === 'repair_release_hotfix_first' ? 'Live backend hotfix is blocked until GitHub commit proof is recorded and passed.' : '',
|
|
2807
|
-
evidenceFreshness.mustCollectNewEvidence === true ? 'Current failure is stale or repeated; only evidence collection is allowed until proof changes.' : ''
|
|
2808
|
-
], __read(requiredEvidence), false).filter(Boolean))).slice(0, 24);
|
|
2809
|
-
var stopConditions = Array.from(new Set(__spreadArray([
|
|
2810
|
-
'Stop if the same failure class, blocker fingerprint, and evidence hash repeat without material evidence.',
|
|
2811
|
-
'Stop if the action would edit outside diagnosis owner_files without a revised diagnosis gate.',
|
|
2812
|
-
'Stop if route-load, screenshot-only, scorecard-only, or model-claim proof is the only acceptance evidence.',
|
|
2813
|
-
liveHotfixBlockedUntilCommit ? 'Stop before live backend hotfix until sourceCommitSha, githubCommitUrl, and passed gitPushStatus are recorded.' : ''
|
|
2814
|
-
], __read(continuationProofCheckpoint.requiredResetEvidence.map(function (entry) { return "Reset requires: ".concat(entry); })), false).filter(Boolean))).slice(0, 24);
|
|
2815
|
-
var createdAt = isoNow(input.now);
|
|
2816
|
-
return {
|
|
2817
|
-
contractId: "support-next-action-".concat(hashResolveIOSupportV5Evidence({
|
|
2818
|
-
action: action,
|
|
2819
|
-
primaryCommand: primaryCommand,
|
|
2820
|
-
reason: reason,
|
|
2821
|
-
blockers: blockers,
|
|
2822
|
-
requiredEvidence: requiredEvidence,
|
|
2823
|
-
evidenceFreshness: evidenceFreshness.evidenceHash,
|
|
2824
|
-
blockerFingerprint: evidenceFreshness.blockerFingerprint,
|
|
2825
|
-
createdAt: createdAt.slice(0, 16)
|
|
2826
|
-
}).slice(0, 16)),
|
|
2827
|
-
action: action,
|
|
2828
|
-
label: label,
|
|
2829
|
-
primaryCommand: primaryCommand,
|
|
2830
|
-
lane: lane,
|
|
2831
|
-
stepType: stepType,
|
|
2832
|
-
safeToAutoRun: safeToAutoRun,
|
|
2833
|
-
requiresHumanApproval: requiresHumanApproval,
|
|
2834
|
-
canRunWithoutCodexMonitor: canRunWithoutCodexMonitor,
|
|
2835
|
-
codexFallbackRequired: codexFallbackRequired,
|
|
2836
|
-
codexFallbackReason: codexFallbackReason,
|
|
2837
|
-
costRisk: costRisk,
|
|
2838
|
-
rootCauseFirstSatisfied: rootCauseReadiness.rootCauseFirstSatisfied === true,
|
|
2839
|
-
decisionBasis: {
|
|
2840
|
-
diagnosisValid: rootCauseReadiness.diagnosisValid === true,
|
|
2841
|
-
ownerFilesReady: rootCauseReadiness.ownerFilesReady === true,
|
|
2842
|
-
proofPlanReady: rootCauseReadiness.proofPlanReady === true,
|
|
2843
|
-
businessProofReady: businessProofReadiness.ready === true,
|
|
2844
|
-
evidenceFreshnessStatus: evidenceFreshness.status,
|
|
2845
|
-
evidenceStrength: evidenceFreshness.evidenceStrength,
|
|
2846
|
-
failureClass: evidenceFreshness.failureClass,
|
|
2847
|
-
blockerFingerprint: evidenceFreshness.blockerFingerprint,
|
|
2848
|
-
evidenceHash: evidenceFreshness.evidenceHash,
|
|
2849
|
-
sameFailureCount: evidenceFreshness.sameFailureCount,
|
|
2850
|
-
hotfixCommitRequired: hotfixCommitRequired,
|
|
2851
|
-
liveHotfixBlockedUntilCommit: liveHotfixBlockedUntilCommit
|
|
2852
|
-
},
|
|
2853
|
-
preconditions: preconditions,
|
|
2854
|
-
expectedStateTransition: nextActionExpectedTransition(action, primaryCommand),
|
|
2855
|
-
successEvidence: Array.from(new Set(requiredEvidence.length ? requiredEvidence : continuationProofCheckpoint.requiredEvidence)).slice(0, 24),
|
|
2856
|
-
stopConditions: stopConditions,
|
|
2857
|
-
forbiddenActions: forbiddenActions.slice(0, 24),
|
|
2858
|
-
ownerFiles: ownerFiles.slice(0, 24),
|
|
2859
|
-
blockers: blockers.slice(0, 24),
|
|
2860
|
-
nextCommands: nextCommands.slice(0, 24),
|
|
2861
|
-
createdAt: createdAt
|
|
2862
|
-
};
|
|
2863
|
-
};
|
|
2864
|
-
var makeDecision = function (action, label, reason, fields) {
|
|
2865
|
-
var _a;
|
|
2866
|
-
var primaryCommand = fields.primaryCommand || action;
|
|
2867
|
-
var nextCommands = fields.nextCommands || [primaryCommand];
|
|
2868
|
-
var requiredEvidence = fields.requiredEvidence || [];
|
|
2869
|
-
var blockers = fields.blockers || [];
|
|
2870
|
-
var rootCauseReadiness = buildRootCauseReadiness(action, reason, fields, primaryCommand, nextCommands, blockers);
|
|
2871
|
-
var forbiddenActions = Array.from(new Set(__spreadArray([
|
|
2872
|
-
'Do not send customer email without explicit human approval.',
|
|
2873
|
-
'Do not broaden owner_files without revised diagnosis evidence.',
|
|
2874
|
-
'Do not accept route-load, screenshot-only, scorecard-only, or model-claim proof.'
|
|
2875
|
-
], __read((fields.forbiddenActions || [])), false)));
|
|
2876
|
-
var continuationProofCheckpoint = buildResolveIOSupportContinuationProofCheckpoint({
|
|
2877
|
-
action: action,
|
|
2878
|
-
reason: reason,
|
|
2879
|
-
evidenceFreshness: evidenceFreshness,
|
|
2880
|
-
requiredEvidence: requiredEvidence,
|
|
2881
|
-
requiredResetEvidence: fields.requiredEvidence,
|
|
2882
|
-
blocksProductRepair: evidenceFreshness.mustCollectNewEvidence === true
|
|
2883
|
-
});
|
|
2884
|
-
var nextActionContract = buildNextActionContract(action, label, reason, fields, rootCauseReadiness, continuationProofCheckpoint, primaryCommand, nextCommands, requiredEvidence, forbiddenActions, blockers);
|
|
2885
|
-
var humanReviewPacket = fields.humanReviewPacket
|
|
2886
|
-
|| (action === 'draft_customer_reply' && customerReplyPolicy.humanReviewPacket ? customerReplyPolicy.humanReviewPacket : undefined)
|
|
2887
|
-
|| buildResolveIOSupportHumanReviewPacket({
|
|
2888
|
-
reviewType: supportAutonomousReviewTypeForAction(action),
|
|
2889
|
-
title: label,
|
|
2890
|
-
summary: reason,
|
|
2891
|
-
primaryAction: primaryCommand,
|
|
2892
|
-
customerFacingDraftAllowed: fields.canDraftCustomerReply === true,
|
|
2893
|
-
safety: action === 'draft_customer_reply' ? 'safe_to_draft' : 'internal_hold',
|
|
2894
|
-
reason: reason,
|
|
2895
|
-
blockers: blockers,
|
|
2896
|
-
requiredEvidence: requiredEvidence,
|
|
2897
|
-
evidenceRefs: businessProofReadiness.artifactPaths,
|
|
2898
|
-
nextCommands: nextCommands,
|
|
2899
|
-
forbiddenActions: forbiddenActions,
|
|
2900
|
-
costRisk: fields.canHotfixBackend === true || action === 'draft_customer_reply'
|
|
2901
|
-
? 'release_or_customer_send'
|
|
2902
|
-
: fields.canRunModel === true
|
|
2903
|
-
? 'expensive_model'
|
|
2904
|
-
: fields.canRunQa === true
|
|
2905
|
-
? 'small_model_or_qa'
|
|
2906
|
-
: 'free_or_deterministic',
|
|
2907
|
-
now: input.now
|
|
2908
|
-
});
|
|
2909
|
-
return {
|
|
2910
|
-
action: action,
|
|
2911
|
-
label: label,
|
|
2912
|
-
reason: reason,
|
|
2913
|
-
canRunAutonomously: fields.canRunAutonomously === true,
|
|
2914
|
-
canEditProductCode: fields.canEditProductCode === true,
|
|
2915
|
-
canRunModel: fields.canRunModel === true,
|
|
2916
|
-
canRunQa: fields.canRunQa === true,
|
|
2917
|
-
canPrepareHotfixPatch: fields.canPrepareHotfixPatch === true,
|
|
2918
|
-
canHotfixBackend: fields.canHotfixBackend === true,
|
|
2919
|
-
liveHotfixBlockedUntilCommit: fields.liveHotfixBlockedUntilCommit === true,
|
|
2920
|
-
canDraftCustomerReply: fields.canDraftCustomerReply === true,
|
|
2921
|
-
canSendCustomerReply: false,
|
|
2922
|
-
lane: fields.lane || (activeMicrotask === null || activeMicrotask === void 0 ? void 0 : activeMicrotask.lane) || 'supervisor',
|
|
2923
|
-
stepType: fields.stepType || activeStepType,
|
|
2924
|
-
microtaskId: activeMicrotask === null || activeMicrotask === void 0 ? void 0 : activeMicrotask.microtaskId,
|
|
2925
|
-
primaryCommand: primaryCommand,
|
|
2926
|
-
nextCommands: nextCommands,
|
|
2927
|
-
requiredEvidence: requiredEvidence,
|
|
2928
|
-
forbiddenActions: forbiddenActions,
|
|
2929
|
-
blockers: blockers,
|
|
2930
|
-
ownerFiles: ownerFiles,
|
|
2931
|
-
issueClass: ((_a = diagnosisValidation.normalized) === null || _a === void 0 ? void 0 : _a.issue_class) || repairGate.issueClass,
|
|
2932
|
-
expectedProof: expectedProof,
|
|
2933
|
-
issueClassProbes: issueClassProbes,
|
|
2934
|
-
activeMicrotask: activeMicrotask,
|
|
2935
|
-
diagnosisValidation: diagnosisValidation,
|
|
2936
|
-
repairGate: repairGate,
|
|
2937
|
-
continuation: continuation,
|
|
2938
|
-
customerReplyPolicy: customerReplyPolicy,
|
|
2939
|
-
businessProofReadiness: businessProofReadiness,
|
|
2940
|
-
evidenceFreshness: evidenceFreshness,
|
|
2941
|
-
rootCauseReadiness: rootCauseReadiness,
|
|
2942
|
-
continuationProofCheckpoint: continuationProofCheckpoint,
|
|
2943
|
-
nextActionContract: nextActionContract,
|
|
2944
|
-
humanReviewPacket: humanReviewPacket,
|
|
2945
|
-
hotfixContinuation: fields.hotfixContinuation,
|
|
2946
|
-
recordedAt: isoNow(input.now)
|
|
2947
|
-
};
|
|
2948
|
-
};
|
|
2949
|
-
if (continuation.action === 'park' && continuation.reason === 'support_v5_budget_guard') {
|
|
2950
|
-
return makeDecision('park_manual', 'Park Manual', continuation.reason, {
|
|
2951
|
-
canRunAutonomously: false,
|
|
2952
|
-
lane: 'supervisor',
|
|
2953
|
-
stepType: 'cleanup',
|
|
2954
|
-
primaryCommand: 'park_support_ticket_for_manual_budget_review',
|
|
2955
|
-
requiredEvidence: ['budget summary', 'latest blocker', 'operator decision'],
|
|
2956
|
-
blockers: ['Support V5 budget guard is active.']
|
|
2957
|
-
});
|
|
2958
|
-
}
|
|
2959
|
-
if (continuation.action === 'park') {
|
|
2960
|
-
return makeDecision('collect_new_evidence', 'Collect New Evidence', continuation.reason, {
|
|
2961
|
-
canRunAutonomously: true,
|
|
2962
|
-
canRunModel: false,
|
|
2963
|
-
canRunQa: true,
|
|
2964
|
-
lane: (activeMicrotask === null || activeMicrotask === void 0 ? void 0 : activeMicrotask.lane) || 'qa',
|
|
2965
|
-
stepType: activeStepType,
|
|
2966
|
-
primaryCommand: 'run_support_v5_recovery_evidence_probe',
|
|
2967
|
-
nextCommands: continuation.recoveryAction.nextCommands,
|
|
2968
|
-
requiredEvidence: continuation.recoveryAction.requiredArtifacts,
|
|
2969
|
-
blockers: [continuation.reason],
|
|
2970
|
-
forbiddenActions: ['Do not run another product-code repair until blockerFingerprint or evidenceHash changes.']
|
|
2971
|
-
});
|
|
2972
|
-
}
|
|
2973
|
-
if (customerReplyPolicy.action === 'ask_clarification') {
|
|
2974
|
-
return makeDecision('ask_customer_clarification', 'Ask Customer Clarification', customerReplyPolicy.reason, {
|
|
2975
|
-
canRunAutonomously: false,
|
|
2976
|
-
canRunModel: false,
|
|
2977
|
-
canEditProductCode: false,
|
|
2978
|
-
canDraftCustomerReply: true,
|
|
2979
|
-
lane: 'customer',
|
|
2980
|
-
stepType: 'customer_reply',
|
|
2981
|
-
primaryCommand: ((_d = customerReplyPolicy.humanReviewPacket) === null || _d === void 0 ? void 0 : _d.primaryAction) || 'review_customer_clarification',
|
|
2982
|
-
nextCommands: ((_e = customerReplyPolicy.humanReviewPacket) === null || _e === void 0 ? void 0 : _e.nextCommands) || ['edit_clarification_question', 'send_after_human_review', 'park_ticket_until_customer_reply'],
|
|
2983
|
-
requiredEvidence: customerReplyPolicy.requiredEvidence,
|
|
2984
|
-
blockers: diagnosisValidation.blockers,
|
|
2985
|
-
forbiddenActions: [
|
|
2986
|
-
'Do not run repair from a guessed reproduction path.',
|
|
2987
|
-
'Do not send customer email without explicit human approval.'
|
|
2988
|
-
],
|
|
2989
|
-
humanReviewPacket: customerReplyPolicy.humanReviewPacket
|
|
2990
|
-
});
|
|
2991
|
-
}
|
|
2992
|
-
if (repairGate.action === 'diagnose_only' || (activeMicrotask === null || activeMicrotask === void 0 ? void 0 : activeMicrotask.type) === 'diagnosis_gate' || !diagnosisValidation.valid) {
|
|
2993
|
-
return makeDecision('run_diagnosis_gate', 'Run Diagnosis Gate', 'support_v5_root_cause_first_required', {
|
|
2994
|
-
canRunAutonomously: true,
|
|
2995
|
-
canRunModel: true,
|
|
2996
|
-
canEditProductCode: false,
|
|
2997
|
-
lane: 'build',
|
|
2998
|
-
stepType: 'diagnosis_gate',
|
|
2999
|
-
primaryCommand: 'run_support_v5_read_only_diagnosis_gate',
|
|
3000
|
-
nextCommands: ['retrieve_similar_tickets_and_commits', 'run_reproduction_or_classification_probe', 'write_support_diagnosis_gate_json'],
|
|
3001
|
-
requiredEvidence: [
|
|
3002
|
-
'issue_case expected/observed/account context',
|
|
3003
|
-
'accepted falsifiable hypothesis',
|
|
3004
|
-
'rejected alternatives',
|
|
3005
|
-
'failing path',
|
|
3006
|
-
'small owner_files set',
|
|
3007
|
-
'before/action/after business proof plan'
|
|
3008
|
-
],
|
|
3009
|
-
blockers: repairGate.blockers,
|
|
3010
|
-
forbiddenActions: ['No source edits during diagnosis.']
|
|
3011
|
-
});
|
|
3012
|
-
}
|
|
3013
|
-
if (repairGate.action === 'infra_repair_only') {
|
|
3014
|
-
return makeDecision('repair_infra_only', 'Repair Infra Only', 'support_v5_infra_failure_before_product_repair', {
|
|
3015
|
-
canRunAutonomously: true,
|
|
3016
|
-
canRunModel: false,
|
|
3017
|
-
canEditProductCode: false,
|
|
3018
|
-
canRunQa: true,
|
|
3019
|
-
lane: 'qa',
|
|
3020
|
-
stepType: activeStepType,
|
|
3021
|
-
primaryCommand: 'run_support_v5_infra_repair',
|
|
3022
|
-
nextCommands: ['rerun_puppeteer_compile_startup_preflight', 'repair_harness_or_cache_only', 'record_infra_artifact'],
|
|
3023
|
-
requiredEvidence: ['preflight log', 'compile/startup/browser status', 'new infra blocker hash or pass'],
|
|
3024
|
-
blockers: repairGate.blockers,
|
|
3025
|
-
forbiddenActions: ['Do not charge infra failures as product-code repair failures.']
|
|
3026
|
-
});
|
|
3027
|
-
}
|
|
3028
|
-
if (repairGate.action === 'reject_out_of_scope') {
|
|
3029
|
-
return makeDecision('revise_diagnosis_scope', 'Revise Diagnosis Scope', 'support_v5_owner_scope_block', {
|
|
3030
|
-
canRunAutonomously: true,
|
|
3031
|
-
canRunModel: true,
|
|
3032
|
-
canEditProductCode: false,
|
|
3033
|
-
lane: 'build',
|
|
3034
|
-
stepType: 'diagnosis_gate',
|
|
3035
|
-
primaryCommand: 'revise_support_diagnosis_gate_with_new_owner_file_evidence',
|
|
3036
|
-
nextCommands: ['attach_out_of_scope_diff', 'prove_new_owner_file_is_required', 'update_support_diagnosis_gate'],
|
|
3037
|
-
requiredEvidence: ['new root-cause evidence for each added owner file'],
|
|
3038
|
-
blockers: repairGate.blockers,
|
|
3039
|
-
forbiddenActions: ['Do not edit files outside owner_files before diagnosis is revised.']
|
|
3040
|
-
});
|
|
3041
|
-
}
|
|
3042
|
-
if (repairGate.action === 'park_repeated_failure') {
|
|
3043
|
-
return makeDecision('collect_new_evidence', 'Collect New Evidence', 'support_v5_repeated_failure_needs_new_evidence', {
|
|
3044
|
-
canRunAutonomously: true,
|
|
3045
|
-
canRunModel: false,
|
|
3046
|
-
canRunQa: true,
|
|
3047
|
-
lane: (activeMicrotask === null || activeMicrotask === void 0 ? void 0 : activeMicrotask.lane) || 'qa',
|
|
3048
|
-
stepType: activeStepType,
|
|
3049
|
-
primaryCommand: 'run_support_v5_recovery_evidence_probe',
|
|
3050
|
-
nextCommands: repairGate.recoveryAction.nextCommands,
|
|
3051
|
-
requiredEvidence: repairGate.recoveryAction.requiredArtifacts,
|
|
3052
|
-
blockers: repairGate.blockers,
|
|
3053
|
-
forbiddenActions: ['Do not run another repair loop until new material evidence exists.']
|
|
3054
|
-
});
|
|
3055
|
-
}
|
|
3056
|
-
if (evidenceFreshness.mustCollectNewEvidence === true && repairGate.action === 'allow_product_repair') {
|
|
3057
|
-
return makeDecision('collect_new_evidence', 'Collect New Evidence', 'support_v5_no_blind_loop_requires_changed_evidence', {
|
|
3058
|
-
canRunAutonomously: true,
|
|
3059
|
-
canRunModel: false,
|
|
3060
|
-
canRunQa: true,
|
|
3061
|
-
canEditProductCode: false,
|
|
3062
|
-
lane: (activeMicrotask === null || activeMicrotask === void 0 ? void 0 : activeMicrotask.lane) || 'qa',
|
|
3063
|
-
stepType: activeStepType,
|
|
3064
|
-
primaryCommand: 'run_support_v5_recovery_evidence_probe',
|
|
3065
|
-
nextCommands: ['execute_issue_class_probe', 'record_changed_blocker_or_business_proof', 'write_aiqa_business_assertion_or_blocker_artifact'],
|
|
3066
|
-
requiredEvidence: evidenceFreshness.requiredResetEvidence.length
|
|
3067
|
-
? evidenceFreshness.requiredResetEvidence
|
|
3068
|
-
: ['changed blockerFingerprint or evidenceHash', 'fresh issue-specific business proof artifact'],
|
|
3069
|
-
blockers: [evidenceFreshness.reason || 'Repeated failure needs fresh evidence before owner-scoped repair.'],
|
|
3070
|
-
forbiddenActions: ['Do not edit product code in this recovery; collect changed browser/data/business-proof evidence only.']
|
|
3071
|
-
});
|
|
3072
|
-
}
|
|
3073
|
-
if (supportReleaseLooksBlocked(input.releaseStatus)) {
|
|
3074
|
-
var releaseBlocker = cleanList(input.unresolvedBlockers, 20, 500).join('; ')
|
|
3075
|
-
|| cleanText(input.blocker || input.releaseStatus, 1000)
|
|
3076
|
-
|| 'Support release is blocked.';
|
|
3077
|
-
var hotfixContinuation = (0, ai_runner_manager_policy_1.decideResolveIOAIManagerHotfixContinuation)({
|
|
3078
|
-
evidence: input.hotfixEvidence,
|
|
3079
|
-
policy: input.releasePolicy,
|
|
3080
|
-
releaseGatePassed: input.releaseGatePassed,
|
|
3081
|
-
failureClass: 'release',
|
|
3082
|
-
blocker: releaseBlocker,
|
|
3083
|
-
now: input.now
|
|
3084
|
-
});
|
|
3085
|
-
var hotfixPrimaryCommandByAction = {
|
|
3086
|
-
record_hotfix_evidence: 'record_hotfix_evidence',
|
|
3087
|
-
request_force_deploy_reason: 'request_force_deploy_reason',
|
|
3088
|
-
rerun_release_gate: 'rerun_support_release_gate_once',
|
|
3089
|
-
continue_runner: 'continue_support_runner_after_committed_hotfix',
|
|
3090
|
-
allow_one_full_deploy: 'execute_one_full_deploy_with_force_evidence',
|
|
3091
|
-
park_manual: 'park_support_release_manual'
|
|
3092
|
-
};
|
|
3093
|
-
var hotfixNextCommands = Array.from(new Set(__spreadArray(__spreadArray([
|
|
3094
|
-
'classify_release_blocker',
|
|
3095
|
-
'prepare_hotfix_patch_without_live_apply',
|
|
3096
|
-
'commit_and_push_hotfix_to_github',
|
|
3097
|
-
'record_github_commit_for_hotfix'
|
|
3098
|
-
], __read(hotfixContinuation.nextCommands), false), [
|
|
3099
|
-
'apply_backend_hotfix_only_after_commit_proof',
|
|
3100
|
-
'rerun_release_gate_once'
|
|
3101
|
-
], false)));
|
|
3102
|
-
var hotfixRequiredEvidence = Array.from(new Set(__spreadArray([
|
|
3103
|
-
'hotfix evidence',
|
|
3104
|
-
'full sourceCommitSha, githubCommitUrl, and passed gitPushStatus for the exact pushed GitHub commit',
|
|
3105
|
-
'checksum before/after',
|
|
3106
|
-
'health/self-test pass',
|
|
3107
|
-
'release gate result'
|
|
3108
|
-
], __read(hotfixContinuation.requiredEvidence), false)));
|
|
3109
|
-
var hotfixForbiddenActions = [
|
|
3110
|
-
'Do not apply a live hotfix before the exact diff is committed and pushed to GitHub.',
|
|
3111
|
-
'Do not mark a hotfix durable without sourceCommitSha, githubCommitUrl, and passed gitPushStatus.',
|
|
3112
|
-
'Do not run a full deploy to clear a duplicate release loop unless force evidence explicitly allows one.'
|
|
3113
|
-
];
|
|
3114
|
-
var hotfixGitGuard = hotfixContinuation.githubCommitGuard;
|
|
3115
|
-
var liveHotfixBlockedUntilCommit = hotfixContinuation.action === 'record_hotfix_evidence'
|
|
3116
|
-
|| (hotfixGitGuard === null || hotfixGitGuard === void 0 ? void 0 : hotfixGitGuard.managerMustCommitBeforeHotfix) === true
|
|
3117
|
-
|| ((hotfixGitGuard === null || hotfixGitGuard === void 0 ? void 0 : hotfixGitGuard.required) === true && (hotfixGitGuard === null || hotfixGitGuard === void 0 ? void 0 : hotfixGitGuard.passed) !== true);
|
|
3118
|
-
var canPrepareHotfixPatch = hotfixContinuation.action !== 'park_manual';
|
|
3119
|
-
return makeDecision('repair_release_hotfix_first', 'Hotfix Release', 'support_v5_release_blocked_hotfix_first', {
|
|
3120
|
-
canRunAutonomously: hotfixContinuation.action !== 'park_manual',
|
|
3121
|
-
canRunModel: false,
|
|
3122
|
-
canEditProductCode: false,
|
|
3123
|
-
canPrepareHotfixPatch: canPrepareHotfixPatch,
|
|
3124
|
-
canHotfixBackend: canPrepareHotfixPatch && !liveHotfixBlockedUntilCommit,
|
|
3125
|
-
liveHotfixBlockedUntilCommit: liveHotfixBlockedUntilCommit,
|
|
3126
|
-
lane: 'release',
|
|
3127
|
-
stepType: 'release_gate',
|
|
3128
|
-
primaryCommand: hotfixPrimaryCommandByAction[hotfixContinuation.action] || 'record_hotfix_evidence',
|
|
3129
|
-
nextCommands: hotfixNextCommands,
|
|
3130
|
-
requiredEvidence: hotfixRequiredEvidence,
|
|
3131
|
-
blockers: Array.from(new Set(__spreadArray(__spreadArray([], __read(cleanList(input.unresolvedBlockers, 20, 500)), false), __read(hotfixContinuation.blockers), false))),
|
|
3132
|
-
forbiddenActions: hotfixForbiddenActions,
|
|
3133
|
-
hotfixContinuation: hotfixContinuation
|
|
3134
|
-
});
|
|
3135
|
-
}
|
|
3136
|
-
if ((activeMicrotask === null || activeMicrotask === void 0 ? void 0 : activeMicrotask.lane) === 'qa' || /^(qa_row|qa_retest|business_proof|route_probe|issue_class_probe)$/.test(activeStepType)) {
|
|
3137
|
-
return makeDecision('run_business_proof_qa', 'Run Business Proof QA', 'support_v5_business_assertion_required', {
|
|
3138
|
-
canRunAutonomously: true,
|
|
3139
|
-
canRunQa: true,
|
|
3140
|
-
canRunModel: false,
|
|
3141
|
-
canEditProductCode: false,
|
|
3142
|
-
lane: 'qa',
|
|
3143
|
-
stepType: /^(qa_row|qa_retest|business_proof|route_probe|issue_class_probe)$/.test(activeStepType) ? activeStepType : 'qa_row',
|
|
3144
|
-
primaryCommand: 'run_support_v5_business_proof_qa_row',
|
|
3145
|
-
nextCommands: ['start_local_stack_if_needed', 'execute_issue_class_probe', 'record_before_action_after_artifacts', 'write_aiqa_business_assertion'],
|
|
3146
|
-
requiredEvidence: Array.from(new Set(__spreadArray(['AIQaBusinessAssertion pass', 'DOM/data proof', 'artifact path', 'Mongo delta when data-changing'], __read(issueClassProbeEvidence), false))),
|
|
3147
|
-
forbiddenActions: ['Route probe pass alone remains route evidence only.']
|
|
3148
|
-
});
|
|
3149
|
-
}
|
|
3150
|
-
if (!activeMicrotask && customerReplyPolicy.action === 'draft_resolution_reply') {
|
|
3151
|
-
return makeDecision('draft_customer_reply', 'Draft Customer Reply', customerReplyPolicy.reason, {
|
|
3152
|
-
canRunAutonomously: true,
|
|
3153
|
-
canRunModel: true,
|
|
3154
|
-
canDraftCustomerReply: true,
|
|
3155
|
-
lane: 'customer',
|
|
3156
|
-
stepType: 'customer_reply',
|
|
3157
|
-
primaryCommand: 'draft_support_customer_resolution_reply',
|
|
3158
|
-
nextCommands: ['summarize_business_proof', 'draft_customer_reply_for_human_review'],
|
|
3159
|
-
requiredEvidence: customerReplyPolicy.requiredEvidence,
|
|
3160
|
-
forbiddenActions: ['Draft only; do not send.']
|
|
3161
|
-
});
|
|
3162
|
-
}
|
|
3163
|
-
if (!activeMicrotask && diagnosisValidation.valid && !businessProofReadiness.ready) {
|
|
3164
|
-
return makeDecision('run_business_proof_qa', 'Run Business Proof QA', businessProofReadiness.reason, {
|
|
3165
|
-
canRunAutonomously: true,
|
|
3166
|
-
canRunQa: true,
|
|
3167
|
-
canRunModel: false,
|
|
3168
|
-
canEditProductCode: false,
|
|
3169
|
-
lane: 'qa',
|
|
3170
|
-
stepType: 'business_proof',
|
|
3171
|
-
primaryCommand: 'run_support_v5_business_proof_qa_row',
|
|
3172
|
-
nextCommands: ['execute_issue_class_probe', 'record_before_action_after_artifacts', 'write_aiqa_business_assertion'],
|
|
3173
|
-
requiredEvidence: Array.from(new Set(__spreadArray(__spreadArray([], __read(businessProofReadiness.requiredEvidence), false), __read(issueClassProbeEvidence), false))),
|
|
3174
|
-
blockers: businessProofReadiness.blockers,
|
|
3175
|
-
forbiddenActions: ['Do not run release or customer reply until businessProofReadiness.ready=true.']
|
|
3176
|
-
});
|
|
3177
|
-
}
|
|
3178
|
-
if (!activeMicrotask && businessProofReadiness.ready) {
|
|
3179
|
-
return makeDecision('ready_for_release_gate', 'Run Release Gate', 'support_v5_business_proof_complete_release_gate_ready', {
|
|
3180
|
-
canRunAutonomously: true,
|
|
3181
|
-
canRunQa: true,
|
|
3182
|
-
lane: 'release',
|
|
3183
|
-
stepType: 'release_gate',
|
|
3184
|
-
primaryCommand: 'run_support_release_gate_once',
|
|
3185
|
-
nextCommands: ['verify_compile_and_business_proof_artifacts', 'run_release_gate_once', 'record_release_status'],
|
|
3186
|
-
requiredEvidence: ['compile pass', 'business assertion artifact', 'release status']
|
|
3187
|
-
});
|
|
3188
|
-
}
|
|
3189
|
-
return makeDecision('run_owner_scoped_repair', 'Run Owner-Scoped Repair', 'support_v5_product_repair_allowed_after_diagnosis', {
|
|
3190
|
-
canRunAutonomously: true,
|
|
3191
|
-
canRunModel: true,
|
|
3192
|
-
canEditProductCode: true,
|
|
3193
|
-
lane: (activeMicrotask === null || activeMicrotask === void 0 ? void 0 : activeMicrotask.lane) || 'build',
|
|
3194
|
-
stepType: activeStepType || 'build_repair',
|
|
3195
|
-
primaryCommand: 'run_support_v5_owner_scoped_repair',
|
|
3196
|
-
nextCommands: ['load_owner_files_only', 'apply_smallest_fix', 'run_smallest_compile_or_unit_gate', 'handoff_to_business_proof_qa'],
|
|
3197
|
-
requiredEvidence: ['changed files within owner_files', 'compile/unit proof', 'next QA row'],
|
|
3198
|
-
forbiddenActions: ['Do not edit outside owner_files unless diagnosis is revised with new evidence.']
|
|
3199
|
-
});
|
|
3200
|
-
}
|
|
3201
|
-
function buildResolveIOSupportV5DiagnoseFirstPrompt(lines) {
|
|
3202
|
-
var _a, _b;
|
|
3203
|
-
return [
|
|
3204
|
-
'Support Runner V5 contract: act like a guarded autonomous engineer, not a gate checklist.',
|
|
3205
|
-
'Start with Diagnose First: observed evidence, likely cause, smallest next action, and expected proof.',
|
|
3206
|
-
'Use compact lane memory and current artifacts before asking for broad ticket context.',
|
|
3207
|
-
'Do not send customer email. Do not write production data. Do not spawn duplicate build, QA, server, client, Mongo, browser, or Codex processes.',
|
|
3208
|
-
'If repairing, inspect logs/artifacts/source/diff first; make the smallest code or localhost-data change, then run the smallest finite self-gate.',
|
|
3209
|
-
'For build repairs, prefer `npm run build-prod -- --watch=false`, a targeted `tsc --noEmit`, or a focused unit test. `npm run build-dev` is forbidden for support microtasks because it is slow/watch-oriented and can leave heavy esbuild work. If no finite gate exists, return a blocked self-gate with the exact reason instead of running build-dev.',
|
|
3210
|
-
'If QA fails, retest the failed row before advancing; if the same blocker repeats without new proof, park with the exact blocker.',
|
|
3211
|
-
lines.goal ? "Goal: ".concat(cleanText(lines.goal, 500)) : '',
|
|
3212
|
-
cleanList(lines.approvedScope, 12, 240).length ? "Approved scope: ".concat(cleanList(lines.approvedScope, 12, 240).join(' | ')) : '',
|
|
3213
|
-
lines.activeStep ? "Active step: ".concat(lines.activeStep) : '',
|
|
3214
|
-
lines.lane ? "Lane: ".concat(lines.lane) : '',
|
|
3215
|
-
lines.laneSummary ? "Lane memory: ".concat(cleanText(lines.laneSummary, 700)) : '',
|
|
3216
|
-
lines.activeBlocker ? "Active blocker: ".concat(cleanText(lines.activeBlocker, 800)) : '',
|
|
3217
|
-
((_a = lines.currentQaRow) === null || _a === void 0 ? void 0 : _a.workflow) ? "Current QA row: ".concat(cleanText(lines.currentQaRow.workflow, 300)) : '',
|
|
3218
|
-
((_b = lines.currentQaRow) === null || _b === void 0 ? void 0 : _b.route) ? "Current QA route: ".concat(cleanText(lines.currentQaRow.route, 300)) : '',
|
|
3219
|
-
cleanList(lines.changedFiles, 12, 200).length ? "Changed files: ".concat(cleanList(lines.changedFiles, 12, 200).join(', ')) : '',
|
|
3220
|
-
cleanList(lines.artifactPaths, 12, 240).length ? "Artifacts: ".concat(cleanList(lines.artifactPaths, 12, 240).join(', ')) : ''
|
|
3221
|
-
].filter(Boolean);
|
|
3222
|
-
}
|
|
3223
|
-
function buildResolveIOSupportV5MicrotaskPrompt(input) {
|
|
3224
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
3225
|
-
var activeMicrotask = selectResolveIOSupportV5ActiveMicrotask(input.bundle.supportV5MicrotaskLedger || [], input.bundle.supportV5ActiveMicrotaskId);
|
|
3226
|
-
var diagnosisValidation = validateResolveIOSupportDiagnosisGate(input.bundle.supportV5DiagnosisGate);
|
|
3227
|
-
var diagnosisGate = diagnosisValidation.normalized || input.bundle.supportV5DiagnosisGate;
|
|
3228
|
-
var diagnosisActive = (activeMicrotask === null || activeMicrotask === void 0 ? void 0 : activeMicrotask.type) === 'diagnosis_gate';
|
|
3229
|
-
var budget = buildResolveIOSupportV5PromptBudget();
|
|
3230
|
-
var repairLike = Boolean(input.failureText || (activeMicrotask === null || activeMicrotask === void 0 ? void 0 : activeMicrotask.status) === 'needs_repair' || /repair/i.test(String(input.stage || (activeMicrotask === null || activeMicrotask === void 0 ? void 0 : activeMicrotask.type) || '')));
|
|
3231
|
-
var cap = repairLike
|
|
3232
|
-
? budget.repairMicrotaskCap
|
|
3233
|
-
: input.lane === 'qa'
|
|
3234
|
-
? budget.qaMicrotaskCap
|
|
3235
|
-
: budget.buildMicrotaskCap;
|
|
3236
|
-
var hardCap = repairLike
|
|
3237
|
-
? budget.repairMicrotaskHardCap
|
|
3238
|
-
: input.lane === 'qa'
|
|
3239
|
-
? budget.qaMicrotaskHardCap
|
|
3240
|
-
: budget.buildMicrotaskHardCap;
|
|
3241
|
-
var laneMemory = input.bundle.supportV5LaneMemory[input.lane];
|
|
3242
|
-
var taskThreadKey = (activeMicrotask === null || activeMicrotask === void 0 ? void 0 : activeMicrotask.threadKey) || laneMemory.threadKey;
|
|
3243
|
-
var changedFiles = cleanList(((_a = input.changedFiles) === null || _a === void 0 ? void 0 : _a.length) ? input.changedFiles : laneMemory.changedFiles, 8, 160);
|
|
3244
|
-
var artifactPaths = cleanList(((_b = input.artifactPaths) === null || _b === void 0 ? void 0 : _b.length) ? input.artifactPaths : laneMemory.artifactPaths, 8, 200);
|
|
3245
|
-
var targetFiles = cleanList(((_c = input.targetFiles) === null || _c === void 0 ? void 0 : _c.length) ? input.targetFiles : activeMicrotask === null || activeMicrotask === void 0 ? void 0 : activeMicrotask.targetFiles, 5, 160);
|
|
3246
|
-
var contextSnippets = cleanList(input.contextSnippets, 5, 360);
|
|
3247
|
-
var diagnosisEvidencePack = buildResolveIOSupportDiagnosisEvidencePack({
|
|
3248
|
-
bundle: input.bundle,
|
|
3249
|
-
similarCaseHints: input.similarCaseHints,
|
|
3250
|
-
issueClass: diagnosisGate === null || diagnosisGate === void 0 ? void 0 : diagnosisGate.issue_class,
|
|
3251
|
-
ownerFiles: (diagnosisGate === null || diagnosisGate === void 0 ? void 0 : diagnosisGate.owner_files) || targetFiles,
|
|
3252
|
-
text: input.bundle.supportV5ScopeDigest || input.bundle.supportV5SupervisorState.currentGoal
|
|
3253
|
-
});
|
|
3254
|
-
var similarCaseSelection = diagnosisEvidencePack.similarCaseSelection;
|
|
3255
|
-
var similarCaseHintsText = ((_d = similarCaseSelection === null || similarCaseSelection === void 0 ? void 0 : similarCaseSelection.ranked) === null || _d === void 0 ? void 0 : _d.length)
|
|
3256
|
-
? __spreadArray([
|
|
3257
|
-
'Similar accepted fix hints. Advisory only: use these to prioritize inspection paths, not as proof.'
|
|
3258
|
-
], __read(similarCaseSelection.ranked.slice(0, 5).map(function (hint, index) {
|
|
3259
|
-
var _a;
|
|
3260
|
-
return [
|
|
3261
|
-
"".concat(index + 1, ". source=").concat(hint.source || 'unknown', " score=").concat(Number(hint.score || 0)),
|
|
3262
|
-
hint.ticketNumber ? "ticket=".concat(hint.ticketNumber) : '',
|
|
3263
|
-
hint.commitSha ? "commit=".concat(hint.commitSha) : '',
|
|
3264
|
-
hint.issueClass ? "issue_class=".concat(hint.issueClass) : '',
|
|
3265
|
-
((_a = hint.ownerFiles) === null || _a === void 0 ? void 0 : _a.length) ? "owner_files=".concat(hint.ownerFiles.slice(0, 4).join(', ')) : '',
|
|
3266
|
-
hint.reason ? "signals=".concat(hint.reason) : '',
|
|
3267
|
-
hint.title ? "title=".concat(cleanText(hint.title, 180)) : ''
|
|
3268
|
-
].filter(Boolean).join(' | ');
|
|
3269
|
-
})), false).join('\n')
|
|
3270
|
-
: '';
|
|
3271
|
-
var qaRow = input.activeQaRow || (activeMicrotask === null || activeMicrotask === void 0 ? void 0 : activeMicrotask.lane) === 'qa'
|
|
3272
|
-
? input.activeQaRow || laneMemory.activeQaRow || input.bundle.supportV5SupervisorState.currentQaRow
|
|
3273
|
-
: undefined;
|
|
3274
|
-
var sections = [
|
|
3275
|
-
{
|
|
3276
|
-
name: 'microtask_contract',
|
|
3277
|
-
text: [
|
|
3278
|
-
'Support Runner V5 Microtask Contract.',
|
|
3279
|
-
'Use the existing persistent lane thread. Do not start a fresh thread.',
|
|
3280
|
-
'Do exactly one microtask and one proof gate. Do not replay ticket triage, prior plans, attachments, broad QA checklist, or unrelated scope.',
|
|
3281
|
-
'If context is insufficient, request the smallest missing file/log/artifact by path and park this microtask; do not broaden the prompt.',
|
|
3282
|
-
'Do not send customer email. Do not deploy. Do not spawn duplicate server/client/Mongo/browser/Codex processes.',
|
|
3283
|
-
diagnosisActive
|
|
3284
|
-
? 'Diagnosis gate hard boundary: read-only investigation only. Do not edit source, generated files, package files, tests, fixtures, QA artifacts, or local data. Return the diagnosis JSON contract only.'
|
|
3285
|
-
: input.lane === 'qa'
|
|
3286
|
-
? 'QA lane hard boundary: the platform preflight owns compile, dependency install, Mongo/server/client startup, and Angular startup. This lane owns only browser/data proof and QA artifacts unless the prompt explicitly says preflight was skipped.'
|
|
3287
|
-
: 'Build lane hard boundary: do not run `npm run build-dev`, `ng build`, `npm run server`, `npm run client`, `ng serve`, `run-local-qa.sh`, browser automation, or any watch/long-lived command. If a broad compile gate is needed, run only `npm run build-prod -- --watch=false`; otherwise use a targeted finite check or return the precise blocker.'
|
|
3288
|
-
].join('\n')
|
|
3289
|
-
},
|
|
3290
|
-
diagnosisActive ? {
|
|
3291
|
-
name: 'root_cause_first_diagnosis_contract',
|
|
3292
|
-
text: [
|
|
3293
|
-
'Before any product-code repair, produce strict JSON only:',
|
|
3294
|
-
'{"support_diagnosis_gate":{"issue_case":{"customer_complaint":"","expected_result":"","observed_result":"","route_module":"","account_customer_context":"","reproduction_status":"reproduced|blocked|classified","reproduction_blocker":""},"issue_class":"no_op_submit|missing_wrong_data|filter_query_mismatch|invoice_pdf_export|upload_import|route_auth_hydration|slow_query_performance","accepted_hypothesis":{"statement":"","falsifiable_test":"","evidence":[""]},"rejected_alternatives":[""],"failing_path":{"frontend":"","backend":"","shared_library":"","data_query":"","description":""},"owner_files":["small/exact/file.ts"],"proof_plan":{"before":"","before_state_unavailable_reason":"","action":"","after":"","business_assertion":"","route":"","data_assertion":"","artifact_expectation":"","business_proof_contract":{"issue_class":"same as diagnosis issue_class","setup_state":"","action_under_test":"","expected_business_state_change":"","prohibited_false_pass":"Route load, screenshot, scorecard, or model claim alone is not acceptance.","proof_artifacts":["browser trace/screenshot/json/mongo delta"],"data_or_dom_assertion":""}},"similar_tickets":[],"similar_commits":[],"evidence":[{"type":"ticket|browser|mongo|log|code|commit|qa|other","summary":"","artifactPath":""}],"status":"passed"}}',
|
|
3295
|
-
'Owner files must be a small exact editable set, not directories, globs, generated wrappers, or broad repo areas.',
|
|
3296
|
-
'The accepted hypothesis must be falsifiable and backed by evidence; prior similar tickets or commits are hints only and cannot bypass fresh diagnosis.',
|
|
3297
|
-
'For reproduction_status="reproduced", evidence must include at least one browser, Mongo, log, or QA evidence object with artifactPath so the runner can replay the proof.',
|
|
3298
|
-
'For reproduction_status="classified", evidence must still include non-ticket root-cause proof such as code, commit, Mongo, log, browser, or QA evidence.',
|
|
3299
|
-
'Ticket text and similar-ticket hints are context, not root-cause proof by themselves.',
|
|
3300
|
-
'The proof plan must be before/action/after business proof plus business_proof_contract. If before-state proof is impossible, explain exactly why in before_state_unavailable_reason.',
|
|
3301
|
-
'The business_proof_contract must name the setup state, action under test, expected business state change, prohibited false pass, required artifacts, and DOM/data assertion.'
|
|
3302
|
-
].join('\n')
|
|
3303
|
-
} : {
|
|
3304
|
-
name: 'diagnosis_gate_context',
|
|
3305
|
-
text: diagnosisValidation.valid && diagnosisGate ? [
|
|
3306
|
-
"Diagnosis issue class: ".concat(diagnosisGate.issue_class),
|
|
3307
|
-
"Accepted hypothesis: ".concat(diagnosisGate.accepted_hypothesis.statement),
|
|
3308
|
-
"Failing path: ".concat(diagnosisGate.failing_path.description || diagnosisGate.failing_path.frontend || diagnosisGate.failing_path.backend || ''),
|
|
3309
|
-
"Owner files: ".concat(diagnosisGate.owner_files.join(', ')),
|
|
3310
|
-
"Business proof required: ".concat(diagnosisGate.proof_plan.business_assertion),
|
|
3311
|
-
diagnosisGate.proof_plan.business_proof_contract
|
|
3312
|
-
? "Business proof contract: ".concat((_e = diagnosisGate.proof_plan.business_proof_contract) === null || _e === void 0 ? void 0 : _e.action_under_test, " -> ").concat((_f = diagnosisGate.proof_plan.business_proof_contract) === null || _f === void 0 ? void 0 : _f.expected_business_state_change, "; assertion ").concat((_g = diagnosisGate.proof_plan.business_proof_contract) === null || _g === void 0 ? void 0 : _g.data_or_dom_assertion)
|
|
3313
|
-
: '',
|
|
3314
|
-
"Before/action/after: ".concat(diagnosisGate.proof_plan.before || diagnosisGate.proof_plan.before_state_unavailable_reason, " -> ").concat(diagnosisGate.proof_plan.action, " -> ").concat(diagnosisGate.proof_plan.after)
|
|
3315
|
-
].filter(Boolean).join('\n') : 'SupportDiagnosisGate is not valid. Park instead of editing product code.'
|
|
3316
|
-
},
|
|
3317
|
-
diagnosisActive ? {
|
|
3318
|
-
name: 'diagnosis_evidence_pack',
|
|
3319
|
-
text: JSON.stringify({
|
|
3320
|
-
packId: diagnosisEvidencePack.packId,
|
|
3321
|
-
status: diagnosisEvidencePack.status,
|
|
3322
|
-
readOnly: diagnosisEvidencePack.readOnly,
|
|
3323
|
-
sourceEditsAllowed: diagnosisEvidencePack.sourceEditsAllowed,
|
|
3324
|
-
requiredOutputKey: diagnosisEvidencePack.requiredOutputKey,
|
|
3325
|
-
requiredFields: diagnosisEvidencePack.requiredFields,
|
|
3326
|
-
requiredEvidence: diagnosisEvidencePack.requiredEvidence,
|
|
3327
|
-
forbiddenActions: diagnosisEvidencePack.forbiddenActions,
|
|
3328
|
-
validationBlockers: diagnosisEvidencePack.validationBlockers,
|
|
3329
|
-
issueClassHint: diagnosisEvidencePack.issueClassHint,
|
|
3330
|
-
ownerFileHints: diagnosisEvidencePack.ownerFileHints,
|
|
3331
|
-
similarHintsAdvisoryOnly: true,
|
|
3332
|
-
similarHintCount: diagnosisEvidencePack.similarCaseSelection.ranked.length,
|
|
3333
|
-
issueClassProbeCatalog: diagnosisEvidencePack.issueClassProbeCatalog.map(function (entry) { return ({
|
|
3334
|
-
issue_class: entry.issue_class,
|
|
3335
|
-
action: entry.action,
|
|
3336
|
-
proof_required: entry.proof_required,
|
|
3337
|
-
acceptance_gate: entry.acceptance_gate,
|
|
3338
|
-
false_pass_blockers: entry.false_pass_blockers
|
|
3339
|
-
}); })
|
|
3340
|
-
})
|
|
3341
|
-
} : undefined,
|
|
3342
|
-
diagnosisActive && similarCaseHintsText ? {
|
|
3343
|
-
name: 'similar_accepted_fix_hints',
|
|
3344
|
-
text: similarCaseHintsText
|
|
3345
|
-
} : undefined,
|
|
3346
|
-
{
|
|
3347
|
-
name: 'scope_digest',
|
|
3348
|
-
text: cleanText(input.bundle.supportV5ScopeDigest || input.bundle.supportV5SupervisorState.approvedScope, 900)
|
|
3349
|
-
},
|
|
3350
|
-
{
|
|
3351
|
-
name: 'active_microtask',
|
|
3352
|
-
text: activeMicrotask ? [
|
|
3353
|
-
"Microtask id: ".concat(activeMicrotask.microtaskId),
|
|
3354
|
-
"Lane: ".concat(input.lane),
|
|
3355
|
-
"Type: ".concat(activeMicrotask.type),
|
|
3356
|
-
"Status: ".concat(activeMicrotask.status),
|
|
3357
|
-
"Objective: ".concat(cleanText(activeMicrotask.objective, 360)),
|
|
3358
|
-
"Self-gate: ".concat(cleanText(activeMicrotask.selfGate, 260)),
|
|
3359
|
-
"Acceptance proof: ".concat(cleanText(activeMicrotask.acceptanceProof, 260)),
|
|
3360
|
-
"Attempts on this microtask: ".concat(activeMicrotask.attempts),
|
|
3361
|
-
"Thread key: ".concat(taskThreadKey)
|
|
3362
|
-
].join('\n') : 'No active microtask found. Park and report support_v5_microtask_missing.'
|
|
3363
|
-
},
|
|
3364
|
-
{
|
|
3365
|
-
name: 'failure_delta',
|
|
3366
|
-
text: input.failureText ? "Latest blocker/failure delta: ".concat(cleanText(input.failureText, 700)) : ''
|
|
3367
|
-
},
|
|
3368
|
-
{
|
|
3369
|
-
name: 'target_context',
|
|
3370
|
-
text: [
|
|
3371
|
-
targetFiles.length ? "Target files: ".concat(targetFiles.join(', ')) : '',
|
|
3372
|
-
changedFiles.length ? "Changed files: ".concat(changedFiles.join(', ')) : '',
|
|
3373
|
-
artifactPaths.length ? "Artifacts: ".concat(artifactPaths.join(', ')) : '',
|
|
3374
|
-
(qaRow === null || qaRow === void 0 ? void 0 : qaRow.workflow) ? "QA row workflow: ".concat(cleanText(qaRow.workflow, 220)) : '',
|
|
3375
|
-
(qaRow === null || qaRow === void 0 ? void 0 : qaRow.route) ? "QA row route: ".concat(cleanText(qaRow.route, 220)) : '',
|
|
3376
|
-
(qaRow === null || qaRow === void 0 ? void 0 : qaRow.assertion) ? "QA row assertion: ".concat(cleanText(qaRow.assertion, 260)) : '',
|
|
3377
|
-
contextSnippets.length ? "Relevant snippets:\n".concat(contextSnippets.join('\n---\n')) : ''
|
|
3378
|
-
].filter(Boolean).join('\n')
|
|
3379
|
-
},
|
|
3380
|
-
input.lane === 'qa' ? {
|
|
3381
|
-
name: 'qa_browser_evidence_contract',
|
|
3382
|
-
text: [
|
|
3383
|
-
'QA lane first action after preflight: collect fresh browser evidence for the active row, not a proof review of existing route/auth artifacts.',
|
|
3384
|
-
'Use the already-running localhost harness and staged env. Before any shell command, run `source .resolveio-support-tools/env.sh 2>/dev/null || source ../.resolveio-support-tools/env.sh 2>/dev/null || true`; then use `$RESOLVEIO_SUPPORT_QA_CLIENT_URL`, `$RESOLVEIO_SUPPORT_QA_SERVER_URL`, `$PUPPETEER_EXECUTABLE_PATH`, and `$CHROME_BIN`.',
|
|
3385
|
-
'Required auth replay helper inside every Puppeteer row script: `const storage=JSON.parse(fs.readFileSync("qa-artifacts/auth-bootstrap-storage-state.json","utf8")); const entries=[...(Array.isArray(storage.localStorageEntries)?storage.localStorageEntries:[]), ...(Array.isArray(storage.localStorage)?storage.localStorage:Object.entries(storage.localStorage||{}).map(([key,value])=>({key,value}))), ...((storage.origins||[]).flatMap(o=>o.localStorage||[]))].map(e=>({key:e.key||e.name,value:e.value})).filter(e=>e.key); const clientUrl=process.env.RESOLVEIO_SUPPORT_QA_CLIENT_URL||process.env.RESOLVEIO_RUNNER_QA_CLIENT_URL; const rowRoute="<ACTIVE_QA_ROUTE>"; await page.goto(clientUrl,{waitUntil:"domcontentloaded"}); await page.evaluate(items=>{localStorage.clear(); for(const item of items)localStorage.setItem(item.key,item.value);}, entries); await page.goto(new URL(rowRoute, clientUrl).href,{waitUntil:"domcontentloaded"});` Replace `<ACTIVE_QA_ROUTE>` with the active row route before running. A screenshot of `/home`, the login screen, or a shell route after this helper means the QA script navigated to the wrong route or storage is stale; rerun the same row with the active route before returning an app blocker.',
|
|
3386
|
-
'Allowed first command shape: one bounded `node`/Puppeteer row script that reads `qa-artifacts/auth-bootstrap-storage-state.json`, opens `$RESOLVEIO_SUPPORT_QA_CLIENT_URL`, seeds localStorage, navigates to the active QA route with `new URL(activeRoute, clientUrl).href`, drives the visible workflow, captures screenshot/caption, and updates the active matrix row. A `/home` proof is invalid for a locked non-home route.',
|
|
3387
|
-
'Forbidden in QA lane after preflight: `npm run build`, `npm run build-dev`, `npm run build-prod`, `ng build`, `npm install`, `npm ci`, `npm run server`, `npm run client`, `ng serve`, `gulp`, `mongod`, `run-local-qa.sh`, and broad source discovery. If a build/startup/dependency problem is suspected, return `blocked` or `needs-fix` with the existing qa-artifacts log paths instead of launching those commands.',
|
|
3388
|
-
'Launch Puppeteer from `PUPPETEER_EXECUTABLE_PATH || CHROME_BIN`, seed localStorage from `qa-artifacts/auth-bootstrap-storage-state.json`, then navigate to the active QA route.',
|
|
3389
|
-
'Before passing, confirm `qa-artifacts/auth-bootstrap-result.json` used the ticket reporter or named affected user when available. If it used generic admin/dev while `qa-live-data-seed-result.json.selected.qa_user_context` names a reporter/affected user, rerun auth as that user or return needs-fix.',
|
|
3390
|
-
'Drive the visible customer workflow for this one row. Capture a new customer-facing screenshot/caption and update `qa-artifacts/qa-coverage-matrix.json` with workflow, route, data id/name, assertion, screenshot path, caption, and pass/failed/blocked status.',
|
|
3391
|
-
'Also write `qa-artifacts/aiqa-business-assertion.json` with one AIQaBusinessAssertion object: assertion, status, workflow, route, before, action, expected, after/observed, dataProof or mongoDelta, artifactPaths, and metadata.supportDiagnosisProof=true only when it maps to the active SupportDiagnosisGate proof_plan.',
|
|
3392
|
-
'After selecting any From/To, source/target, dropdown, combobox, rio-select, filter, item, customer, yard, chemical, or treatment-plan value, read the visible control text back from the DOM. If it still contains placeholder text such as Select Chemical, Select Yard, Select Customer, Select Treatment Plan Type, Loading..., empty, null, or undefined, do not click the action button and do not mark pass. Capture the selected-state blocker screenshot/DOM text and return needs-fix.',
|
|
3393
|
-
'If the row needs persisted data proof, create that proof yourself in the same bounded QA command by querying localhost QA Mongo through process.env.MONGO_URL after the visible UI action. Write the result under qa-artifacts/ as JSON and reference that path in the matrix. Do not ask for a missing post-action DB artifact while the local QA stack is running; either write it or return needs-fix with the exact query/script error. For update-interchangeables rows, the JSON must include concrete non-placeholder fromText and toText, before/after counts or sample documents for treatment plans and tank/interchangeable records, and must fail if either selected value is only an arrow/placeholder or if the persisted collections are empty.',
|
|
3394
|
-
'If the row names multiple concrete entities such as assets, units, BOLs, invoices, chemicals, customers, yards, or numbered records, prove every named entity. Do not pass by proving only one representative record.',
|
|
3395
|
-
'For customer-reported data bugs, use production-seeded localhost records from `qa-live-data-seed-result.json`. If the exact named record is missing from the seed, fail the row as a seed/query blocker instead of testing a substitute record.',
|
|
3396
|
-
'Route-ready, auth-bootstrap, shell, header-only, and empty-list screenshots do not satisfy this microtask. If the row cannot be proven, capture the blocker screenshot/DOM state and return needs-fix with that exact blocker.',
|
|
3397
|
-
'Do not run compile/startup/npm install, do not spawn another server/client/Mongo, and do not inspect broad source trees before the first browser evidence command.'
|
|
3398
|
-
].join('\n')
|
|
3399
|
-
} : {
|
|
3400
|
-
name: 'non_qa_noop',
|
|
3401
|
-
text: ''
|
|
3402
|
-
},
|
|
3403
|
-
{
|
|
3404
|
-
name: 'return_contract',
|
|
3405
|
-
text: diagnosisActive
|
|
3406
|
-
? 'Return strict JSON only with support_diagnosis_gate. Do not include Markdown and do not edit files.'
|
|
3407
|
-
: input.lane === 'qa'
|
|
3408
|
-
? 'Return strict JSON only: {"status":"pass"|"needs-fix"|"blocked","microtaskId":"","summary":"","evidence":[""],"artifacts":[""],"next_actions":[""]}.'
|
|
3409
|
-
: 'Return concise Markdown with: Microtask Result, Root Cause, Changes, Self-Gate, Acceptance Proof, Residual Risk.'
|
|
3410
|
-
}
|
|
3411
|
-
].filter(function (section) { return !!section && !!cleanText(section.text, 20); });
|
|
3412
|
-
var promptSections = sections.map(function (section) { return ({
|
|
3413
|
-
name: section.name,
|
|
3414
|
-
tokenEstimate: estimateTextTokens(section.text)
|
|
3415
|
-
}); });
|
|
3416
|
-
var prompt = sections.map(function (section) { return section.text; }).join('\n\n');
|
|
3417
|
-
var promptTokenEstimate = estimateTextTokens(prompt);
|
|
3418
|
-
return {
|
|
3419
|
-
prompt: prompt,
|
|
3420
|
-
promptTokenEstimate: promptTokenEstimate,
|
|
3421
|
-
promptSections: promptSections,
|
|
3422
|
-
diagnosisEvidencePack: diagnosisEvidencePack,
|
|
3423
|
-
activeMicrotask: activeMicrotask,
|
|
3424
|
-
withinCap: promptTokenEstimate <= cap,
|
|
3425
|
-
withinHardCap: promptTokenEstimate <= hardCap,
|
|
3426
|
-
cap: cap,
|
|
3427
|
-
hardCap: hardCap,
|
|
3428
|
-
reason: promptTokenEstimate > hardCap
|
|
3429
|
-
? 'support_v5_microtask_prompt_hard_cap'
|
|
3430
|
-
: promptTokenEstimate > cap
|
|
3431
|
-
? 'support_v5_microtask_prompt_soft_cap'
|
|
3432
|
-
: undefined
|
|
3433
|
-
};
|
|
3434
|
-
}
|
|
3435
|
-
function summarizeResolveIOSupportV5MicrotaskUsage(bundle) {
|
|
3436
|
-
var e_8, _a, e_9, _b;
|
|
3437
|
-
var byMicrotask = new Map();
|
|
3438
|
-
var bySection = new Map();
|
|
3439
|
-
var totalPromptTokenEstimate = 0;
|
|
3440
|
-
var broadPromptViolations = [];
|
|
3441
|
-
var promptBudget = buildResolveIOSupportV5PromptBudget();
|
|
3442
|
-
try {
|
|
3443
|
-
for (var _c = __values(bundle.supportV5MicrotaskUsageHistory || []), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
3444
|
-
var usage = _d.value;
|
|
3445
|
-
totalPromptTokenEstimate += usage.promptTokenEstimate || 0;
|
|
3446
|
-
var existing = byMicrotask.get(usage.microtaskId) || { microtaskId: usage.microtaskId, promptTokenEstimate: 0, calls: 0 };
|
|
3447
|
-
existing.promptTokenEstimate += usage.promptTokenEstimate || 0;
|
|
3448
|
-
existing.calls += 1;
|
|
3449
|
-
byMicrotask.set(usage.microtaskId, existing);
|
|
3450
|
-
try {
|
|
3451
|
-
for (var _e = (e_9 = void 0, __values(usage.promptSections || [])), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
3452
|
-
var section = _f.value;
|
|
3453
|
-
bySection.set(section.name, (bySection.get(section.name) || 0) + section.tokenEstimate);
|
|
3454
|
-
}
|
|
3455
|
-
}
|
|
3456
|
-
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
3457
|
-
finally {
|
|
3458
|
-
try {
|
|
3459
|
-
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
3460
|
-
}
|
|
3461
|
-
finally { if (e_9) throw e_9.error; }
|
|
3462
|
-
}
|
|
3463
|
-
var hardCap = usage.lane === 'qa' ? promptBudget.qaMicrotaskHardCap : promptBudget.buildMicrotaskHardCap;
|
|
3464
|
-
if ((usage.promptTokenEstimate || 0) > hardCap) {
|
|
3465
|
-
broadPromptViolations.push(usage);
|
|
3466
|
-
}
|
|
3467
|
-
}
|
|
3468
|
-
}
|
|
3469
|
-
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
3470
|
-
finally {
|
|
3471
|
-
try {
|
|
3472
|
-
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
3473
|
-
}
|
|
3474
|
-
finally { if (e_8) throw e_8.error; }
|
|
3475
|
-
}
|
|
3476
|
-
return {
|
|
3477
|
-
totalPromptTokenEstimate: totalPromptTokenEstimate,
|
|
3478
|
-
byMicrotask: Array.from(byMicrotask.values()),
|
|
3479
|
-
bySection: Array.from(bySection.entries()).map(function (_a) {
|
|
3480
|
-
var _b = __read(_a, 2), name = _b[0], tokenEstimate = _b[1];
|
|
3481
|
-
return ({ name: name, tokenEstimate: tokenEstimate });
|
|
3482
|
-
}),
|
|
3483
|
-
broadPromptViolations: broadPromptViolations
|
|
3484
|
-
};
|
|
3485
|
-
}
|
|
3486
|
-
function buildResolveIOSupportV5Incident(input) {
|
|
3487
|
-
return {
|
|
3488
|
-
incidentClass: cleanText(input.incidentClass, 120) || 'support_v5_runner_incident',
|
|
3489
|
-
summary: cleanText(input.summary, 1200),
|
|
3490
|
-
stepType: input.stepType,
|
|
3491
|
-
blockerFingerprint: input.blocker ? fingerprintResolveIOSupportV5Blocker(input.blocker) : undefined,
|
|
3492
|
-
artifactPaths: cleanList(input.artifactPaths, 40, 500),
|
|
3493
|
-
recordedAt: isoNow(input.now)
|
|
3494
|
-
};
|
|
3495
|
-
}
|
|
3496
|
-
|
|
3497
|
-
//# sourceMappingURL=support-runner-v5.js.map
|