@resolveio/server-lib 22.3.221 → 22.3.223
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ai/assistant-core-heuristics.d.ts +11 -0
- package/ai/assistant-core-heuristics.js +356 -0
- package/ai/assistant-core-heuristics.js.map +1 -0
- package/ai/resolveio-platform-intelligence-memory-corpus.d.ts +3 -0
- package/ai/resolveio-platform-intelligence-memory-corpus.js +214 -0
- package/ai/resolveio-platform-intelligence-memory-corpus.js.map +1 -0
- package/ai/resolveio-platform-intelligence-memory.d.ts +20 -0
- package/ai/resolveio-platform-intelligence-memory.js +341 -0
- package/ai/resolveio-platform-intelligence-memory.js.map +1 -0
- package/{src/ai/resolveio-platform-intelligence-types.ts → ai/resolveio-platform-intelligence-types.d.ts} +15 -20
- package/ai/resolveio-platform-intelligence-types.js +4 -0
- package/ai/resolveio-platform-intelligence-types.js.map +1 -0
- package/ai/resolveio-platform-intelligence.d.ts +6 -0
- package/ai/resolveio-platform-intelligence.js +463 -0
- package/ai/resolveio-platform-intelligence.js.map +1 -0
- package/client-server-app.d.ts +1 -0
- package/client-server-app.js +68 -0
- package/client-server-app.js.map +1 -0
- package/collections/ai-run.collection.d.ts +3 -0
- package/collections/ai-run.collection.js +170 -0
- package/collections/ai-run.collection.js.map +1 -0
- package/collections/ai-terminal-conversation.collection.d.ts +2 -0
- package/collections/ai-terminal-conversation.collection.js +140 -0
- package/collections/ai-terminal-conversation.collection.js.map +1 -0
- package/collections/ai-terminal-issue-report.collection.d.ts +2 -0
- package/collections/ai-terminal-issue-report.collection.js +148 -0
- package/collections/ai-terminal-issue-report.collection.js.map +1 -0
- package/collections/ai-terminal-message.collection.d.ts +2 -0
- package/collections/ai-terminal-message.collection.js +121 -0
- package/collections/ai-terminal-message.collection.js.map +1 -0
- package/collections/app-setting.collection.d.ts +3 -0
- package/collections/app-setting.collection.js +103 -0
- package/collections/app-setting.collection.js.map +1 -0
- package/collections/app-status.collection.d.ts +3 -0
- package/collections/app-status.collection.js +57 -0
- package/collections/app-status.collection.js.map +1 -0
- package/collections/communication-metric.collection.d.ts +2 -0
- package/collections/communication-metric.collection.js +133 -0
- package/collections/communication-metric.collection.js.map +1 -0
- package/collections/counter.collection.d.ts +3 -0
- package/collections/counter.collection.js +56 -0
- package/collections/counter.collection.js.map +1 -0
- package/collections/cron-job-history.collection.d.ts +3 -0
- package/collections/cron-job-history.collection.js +137 -0
- package/collections/cron-job-history.collection.js.map +1 -0
- package/collections/cron-job.collection.d.ts +3 -0
- package/collections/cron-job.collection.js +92 -0
- package/collections/cron-job.collection.js.map +1 -0
- package/collections/customer-notification.collection.d.ts +3 -0
- package/collections/customer-notification.collection.js +130 -0
- package/collections/customer-notification.collection.js.map +1 -0
- package/collections/customer-portal-password.collection.d.ts +3 -0
- package/collections/customer-portal-password.collection.js +75 -0
- package/collections/customer-portal-password.collection.js.map +1 -0
- package/collections/email-history.collection.d.ts +3 -0
- package/collections/email-history.collection.js +134 -0
- package/collections/email-history.collection.js.map +1 -0
- package/collections/email-verified.collection.d.ts +3 -0
- package/collections/email-verified.collection.js +62 -0
- package/collections/email-verified.collection.js.map +1 -0
- package/collections/file.collection.d.ts +3 -0
- package/collections/file.collection.js +74 -0
- package/collections/file.collection.js.map +1 -0
- package/collections/flag-update.collection.d.ts +3 -0
- package/collections/flag-update.collection.js +57 -0
- package/collections/flag-update.collection.js.map +1 -0
- package/collections/flag.collection.d.ts +3 -0
- package/collections/flag.collection.js +57 -0
- package/collections/flag.collection.js.map +1 -0
- package/collections/log-method-latency.collection.d.ts +3 -0
- package/collections/log-method-latency.collection.js +77 -0
- package/collections/log-method-latency.collection.js.map +1 -0
- package/collections/log-subscription.collection.d.ts +3 -0
- package/collections/log-subscription.collection.js +80 -0
- package/collections/log-subscription.collection.js.map +1 -0
- package/collections/log.collection.d.ts +3 -0
- package/collections/log.collection.js +93 -0
- package/collections/log.collection.js.map +1 -0
- package/collections/logged-in-users.collection.d.ts +3 -0
- package/collections/logged-in-users.collection.js +67 -0
- package/collections/logged-in-users.collection.js.map +1 -0
- package/collections/monitor-cpu.collection.d.ts +3 -0
- package/collections/monitor-cpu.collection.js +65 -0
- package/collections/monitor-cpu.collection.js.map +1 -0
- package/collections/monitor-function.collection.d.ts +3 -0
- package/collections/monitor-function.collection.js +74 -0
- package/collections/monitor-function.collection.js.map +1 -0
- package/collections/monitor-memory.collection.d.ts +3 -0
- package/collections/monitor-memory.collection.js +77 -0
- package/collections/monitor-memory.collection.js.map +1 -0
- package/collections/monitor-mongo.collection.d.ts +3 -0
- package/collections/monitor-mongo.collection.js +71 -0
- package/collections/monitor-mongo.collection.js.map +1 -0
- package/collections/notification.collection.d.ts +3 -0
- package/collections/notification.collection.js +57 -0
- package/collections/notification.collection.js.map +1 -0
- package/collections/openai-usage-ledger.collection.d.ts +2 -0
- package/collections/openai-usage-ledger.collection.js +188 -0
- package/collections/openai-usage-ledger.collection.js.map +1 -0
- package/collections/report-builder-dashboard-builder.collection.d.ts +3 -0
- package/collections/report-builder-dashboard-builder.collection.js +109 -0
- package/collections/report-builder-dashboard-builder.collection.js.map +1 -0
- package/collections/report-builder-library.collection.d.ts +3 -0
- package/collections/report-builder-library.collection.js +87 -0
- package/collections/report-builder-library.collection.js.map +1 -0
- package/collections/report-builder-report.collection.d.ts +4 -0
- package/collections/report-builder-report.collection.js +184 -0
- package/collections/report-builder-report.collection.js.map +1 -0
- package/collections/user-group.collection.d.ts +4 -0
- package/collections/user-group.collection.js +89 -0
- package/collections/user-group.collection.js.map +1 -0
- package/collections/user-guide.collection.d.ts +3 -0
- package/collections/user-guide.collection.js +57 -0
- package/collections/user-guide.collection.js.map +1 -0
- package/collections/user.collection.d.ts +4 -0
- package/collections/user.collection.js +180 -0
- package/collections/user.collection.js.map +1 -0
- package/cron/cron.d.ts +14 -0
- package/cron/cron.js +216 -0
- package/cron/cron.js.map +1 -0
- package/fixtures/cron-jobs.d.ts +1 -0
- package/fixtures/cron-jobs.js +150 -0
- package/fixtures/cron-jobs.js.map +1 -0
- package/fixtures/init.d.ts +1 -0
- package/fixtures/init.js +91 -0
- package/fixtures/init.js.map +1 -0
- package/http/auth.d.ts +2 -0
- package/http/auth.js +951 -0
- package/http/auth.js.map +1 -0
- package/http/health.d.ts +1 -0
- package/http/health.js +11 -0
- package/http/health.js.map +1 -0
- package/http/home.d.ts +1 -0
- package/http/home.js +134 -0
- package/http/home.js.map +1 -0
- package/http/slow-query-publication.d.ts +2 -0
- package/http/slow-query-publication.js +99 -0
- package/http/slow-query-publication.js.map +1 -0
- package/index.d.ts +1 -0
- package/index.js +19 -0
- package/index.js.map +1 -0
- package/managers/ai-assistant-codex-manager.manager.d.ts +67 -0
- package/managers/ai-assistant-codex-manager.manager.js +1113 -0
- package/managers/ai-assistant-codex-manager.manager.js.map +1 -0
- package/managers/ai-run-evidence.manager.d.ts +36 -0
- package/managers/ai-run-evidence.manager.js +377 -0
- package/managers/ai-run-evidence.manager.js.map +1 -0
- package/managers/communication-metric.manager.d.ts +16 -0
- package/managers/communication-metric.manager.js +134 -0
- package/managers/communication-metric.manager.js.map +1 -0
- package/managers/cron.manager.d.ts +20 -0
- package/managers/cron.manager.js +534 -0
- package/managers/cron.manager.js.map +1 -0
- package/managers/customer-notification-content.manager.d.ts +55 -0
- package/managers/customer-notification-content.manager.js +158 -0
- package/managers/customer-notification-content.manager.js.map +1 -0
- package/managers/diagnostic-manager-bootstrap.d.ts +9 -0
- package/managers/diagnostic-manager-bootstrap.js +260 -0
- package/managers/diagnostic-manager-bootstrap.js.map +1 -0
- package/managers/error-auto-fix.manager.d.ts +149 -0
- package/managers/error-auto-fix.manager.js +3064 -0
- package/managers/error-auto-fix.manager.js.map +1 -0
- package/managers/local-log.manager.d.ts +18 -0
- package/managers/local-log.manager.js +88 -0
- package/managers/local-log.manager.js.map +1 -0
- package/managers/method.manager.d.ts +84 -0
- package/managers/method.manager.js +1964 -0
- package/managers/method.manager.js.map +1 -0
- package/managers/mongo.manager.d.ts +224 -0
- package/managers/mongo.manager.js +5000 -0
- package/managers/mongo.manager.js.map +1 -0
- package/managers/monitor.manager.d.ts +70 -0
- package/managers/monitor.manager.js +550 -0
- package/managers/monitor.manager.js.map +1 -0
- package/managers/openai-usage-ledger.manager.d.ts +30 -0
- package/managers/openai-usage-ledger.manager.js +142 -0
- package/managers/openai-usage-ledger.manager.js.map +1 -0
- package/managers/slow-query-verifier.manager.d.ts +144 -0
- package/managers/slow-query-verifier.manager.js +3857 -0
- package/managers/slow-query-verifier.manager.js.map +1 -0
- package/managers/slow-query.manager.d.ts +28 -0
- package/managers/slow-query.manager.js +468 -0
- package/managers/slow-query.manager.js.map +1 -0
- package/managers/subscription.manager.d.ts +169 -0
- package/managers/subscription.manager.js +3434 -0
- package/managers/subscription.manager.js.map +1 -0
- package/managers/websocket.manager.d.ts +73 -0
- package/managers/websocket.manager.js +673 -0
- package/managers/websocket.manager.js.map +1 -0
- package/managers/worker-dispatcher.manager.d.ts +120 -0
- package/managers/worker-dispatcher.manager.js +1266 -0
- package/managers/worker-dispatcher.manager.js.map +1 -0
- package/managers/worker-server.manager.d.ts +35 -0
- package/managers/worker-server.manager.js +582 -0
- package/managers/worker-server.manager.js.map +1 -0
- package/methods/accounts.d.ts +2 -0
- package/methods/accounts.js +624 -0
- package/methods/accounts.js.map +1 -0
- package/methods/ai-terminal.d.ts +458 -0
- package/methods/ai-terminal.js +27991 -0
- package/methods/ai-terminal.js.map +1 -0
- package/methods/app-settings.d.ts +2 -0
- package/methods/app-settings.js +169 -0
- package/methods/app-settings.js.map +1 -0
- package/methods/aws.d.ts +2 -0
- package/methods/aws.js +877 -0
- package/methods/aws.js.map +1 -0
- package/methods/collections.d.ts +2 -0
- package/methods/collections.js +719 -0
- package/methods/collections.js.map +1 -0
- package/methods/counters.d.ts +2 -0
- package/methods/counters.js +113 -0
- package/methods/counters.js.map +1 -0
- package/methods/cron-jobs.d.ts +2 -0
- package/methods/cron-jobs.js +2475 -0
- package/methods/cron-jobs.js.map +1 -0
- package/methods/customer-notifications.d.ts +2 -0
- package/methods/customer-notifications.js +528 -0
- package/methods/customer-notifications.js.map +1 -0
- package/methods/diagnostics.d.ts +2 -0
- package/methods/diagnostics.js +703 -0
- package/methods/diagnostics.js.map +1 -0
- package/methods/flag-updates.d.ts +2 -0
- package/methods/flag-updates.js +8 -0
- package/methods/flag-updates.js.map +1 -0
- package/methods/flags.d.ts +2 -0
- package/methods/flags.js +8 -0
- package/methods/flags.js.map +1 -0
- package/methods/logs.d.ts +2 -0
- package/methods/logs.js +751 -0
- package/methods/logs.js.map +1 -0
- package/methods/mongo-explorer.d.ts +2 -0
- package/methods/mongo-explorer.js +1808 -0
- package/methods/mongo-explorer.js.map +1 -0
- package/methods/monitor.d.ts +2 -0
- package/methods/monitor.js +543 -0
- package/methods/monitor.js.map +1 -0
- package/methods/pdf.d.ts +2 -0
- package/methods/pdf.js +1216 -0
- package/methods/pdf.js.map +1 -0
- package/methods/publications.d.ts +1 -0
- package/methods/publications.js +183 -0
- package/methods/publications.js.map +1 -0
- package/methods/report-builder.d.ts +2 -0
- package/methods/report-builder.js +3094 -0
- package/methods/report-builder.js.map +1 -0
- package/methods/support.d.ts +2 -0
- package/methods/support.js +430 -0
- package/methods/support.js.map +1 -0
- package/models/ai-run.model.d.ts +19 -0
- package/models/ai-run.model.js +4 -0
- package/models/ai-run.model.js.map +1 -0
- package/models/ai-terminal-conversation.model.d.ts +17 -0
- package/models/ai-terminal-conversation.model.js +4 -0
- package/models/ai-terminal-conversation.model.js.map +1 -0
- package/models/ai-terminal-issue-report.model.d.ts +19 -0
- package/models/ai-terminal-issue-report.model.js +4 -0
- package/models/ai-terminal-issue-report.model.js.map +1 -0
- package/models/ai-terminal-message.model.d.ts +22 -0
- package/models/ai-terminal-message.model.js +4 -0
- package/models/ai-terminal-message.model.js.map +1 -0
- package/models/app-setting.model.d.ts +16 -0
- package/models/app-setting.model.js +4 -0
- package/models/app-setting.model.js.map +1 -0
- package/{src/models/app-status.model.ts → models/app-status.model.d.ts} +2 -3
- package/models/app-status.model.js +4 -0
- package/models/app-status.model.js.map +1 -0
- package/{src/models/billing-logged-in-users.model.ts → models/billing-logged-in-users.model.d.ts} +4 -5
- package/models/billing-logged-in-users.model.js +4 -0
- package/models/billing-logged-in-users.model.js.map +1 -0
- package/models/collection-document.model.d.ts +21 -0
- package/models/collection-document.model.js +4 -0
- package/models/collection-document.model.js.map +1 -0
- package/models/communication-metric.model.d.ts +20 -0
- package/models/communication-metric.model.js +4 -0
- package/models/communication-metric.model.js.map +1 -0
- package/{src/models/counter.model.ts → models/counter.model.d.ts} +3 -4
- package/models/counter.model.js +4 -0
- package/models/counter.model.js.map +1 -0
- package/models/cron-job-history.model.d.ts +15 -0
- package/models/cron-job-history.model.js +4 -0
- package/models/cron-job-history.model.js.map +1 -0
- package/models/cron-job.model.d.ts +14 -0
- package/models/cron-job.model.js +4 -0
- package/models/cron-job.model.js.map +1 -0
- package/models/customer-notification.model.d.ts +26 -0
- package/models/customer-notification.model.js +4 -0
- package/models/customer-notification.model.js.map +1 -0
- package/models/customer-portal-password.model.d.ts +11 -0
- package/models/customer-portal-password.model.js +4 -0
- package/models/customer-portal-password.model.js.map +1 -0
- package/models/dialog.model.d.ts +23 -0
- package/models/dialog.model.js +4 -0
- package/models/dialog.model.js.map +1 -0
- package/models/email-history.model.d.ts +32 -0
- package/{src/models/email-history.model.ts → models/email-history.model.js} +4 -36
- package/models/email-history.model.js.map +1 -0
- package/{src/models/email-verified.model.ts → models/email-verified.model.d.ts} +5 -6
- package/models/email-verified.model.js +4 -0
- package/models/email-verified.model.js.map +1 -0
- package/{src/models/file.model.ts → models/file.model.d.ts} +7 -8
- package/models/file.model.js +4 -0
- package/models/file.model.js.map +1 -0
- package/{src/models/flag-update.model.ts → models/flag-update.model.d.ts} +3 -4
- package/models/flag-update.model.js +4 -0
- package/models/flag-update.model.js.map +1 -0
- package/{src/models/flag.model.ts → models/flag.model.d.ts} +3 -4
- package/models/flag.model.js +4 -0
- package/models/flag.model.js.map +1 -0
- package/models/log-method-latency.model.d.ts +10 -0
- package/models/log-method-latency.model.js +4 -0
- package/models/log-method-latency.model.js.map +1 -0
- package/{src/models/log-subscription.model.ts → models/log-subscription.model.d.ts} +9 -11
- package/models/log-subscription.model.js +4 -0
- package/models/log-subscription.model.js.map +1 -0
- package/models/log.model.d.ts +17 -0
- package/models/log.model.js +4 -0
- package/models/log.model.js.map +1 -0
- package/{src/models/logged-in-users.model.ts → models/logged-in-users.model.d.ts} +5 -6
- package/models/logged-in-users.model.js +4 -0
- package/models/logged-in-users.model.js.map +1 -0
- package/{src/models/method-response.model.ts → models/method-response.model.d.ts} +6 -7
- package/models/method-response.model.js +4 -0
- package/models/method-response.model.js.map +1 -0
- package/models/method.model.d.ts +26 -0
- package/models/method.model.js +4 -0
- package/models/method.model.js.map +1 -0
- package/{src/models/monitor-cpu.model.ts → models/monitor-cpu.model.d.ts} +7 -9
- package/models/monitor-cpu.model.js +4 -0
- package/models/monitor-cpu.model.js.map +1 -0
- package/models/monitor-function.model.d.ts +14 -0
- package/models/monitor-function.model.js +4 -0
- package/models/monitor-function.model.js.map +1 -0
- package/models/monitor-memory.model.d.ts +15 -0
- package/models/monitor-memory.model.js +4 -0
- package/models/monitor-memory.model.js.map +1 -0
- package/models/monitor-mongo.model.d.ts +13 -0
- package/models/monitor-mongo.model.js +4 -0
- package/models/monitor-mongo.model.js.map +1 -0
- package/{src/models/notification.model.ts → models/notification.model.d.ts} +4 -6
- package/models/notification.model.js +4 -0
- package/models/notification.model.js.map +1 -0
- package/models/openai-usage-ledger.model.d.ts +30 -0
- package/models/openai-usage-ledger.model.js +4 -0
- package/models/openai-usage-ledger.model.js.map +1 -0
- package/models/pagination.model.d.ts +11 -0
- package/models/pagination.model.js +28 -0
- package/models/pagination.model.js.map +1 -0
- package/models/permission.model.d.ts +12 -0
- package/models/permission.model.js +4 -0
- package/models/permission.model.js.map +1 -0
- package/models/report-builder-dashboard-builder.model.d.ts +25 -0
- package/models/report-builder-dashboard-builder.model.js +4 -0
- package/models/report-builder-dashboard-builder.model.js.map +1 -0
- package/models/report-builder-library.model.d.ts +17 -0
- package/models/report-builder-library.model.js +4 -0
- package/models/report-builder-library.model.js.map +1 -0
- package/models/report-builder-report.model.d.ts +121 -0
- package/models/report-builder-report.model.js +4 -0
- package/models/report-builder-report.model.js.map +1 -0
- package/models/report-builder.model.d.ts +61 -0
- package/models/report-builder.model.js +4 -0
- package/models/report-builder.model.js.map +1 -0
- package/models/select-data-label.model.d.ts +9 -0
- package/models/select-data-label.model.js +4 -0
- package/models/select-data-label.model.js.map +1 -0
- package/models/server-message.model.d.ts +32 -0
- package/models/server-message.model.js +4 -0
- package/models/server-message.model.js.map +1 -0
- package/models/slow-query-report.model.d.ts +23 -0
- package/models/slow-query-report.model.js +4 -0
- package/models/slow-query-report.model.js.map +1 -0
- package/models/subscription.model.d.ts +31 -0
- package/models/subscription.model.js +4 -0
- package/models/subscription.model.js.map +1 -0
- package/models/support-ticket.model.d.ts +87 -0
- package/models/support-ticket.model.js +4 -0
- package/models/support-ticket.model.js.map +1 -0
- package/models/user-group.model.d.ts +20 -0
- package/models/user-group.model.js +4 -0
- package/models/user-group.model.js.map +1 -0
- package/{src/models/user-guide.model.ts → models/user-guide.model.d.ts} +4 -5
- package/models/user-guide.model.js +4 -0
- package/models/user-guide.model.js.map +1 -0
- package/models/user.model.d.ts +84 -0
- package/models/user.model.js +4 -0
- package/models/user.model.js.map +1 -0
- package/package.json +1 -1
- package/private/images/ResolveIO.png +0 -0
- package/public_api.js +127 -0
- package/public_api.js.map +1 -0
- package/publications/ai-terminal.d.ts +1 -0
- package/publications/ai-terminal.js +122 -0
- package/publications/ai-terminal.js.map +1 -0
- package/publications/app-settings.d.ts +2 -0
- package/publications/app-settings.js +28 -0
- package/publications/app-settings.js.map +1 -0
- package/publications/app-status.d.ts +2 -0
- package/publications/app-status.js +16 -0
- package/publications/app-status.js.map +1 -0
- package/publications/cron-jobs.d.ts +2 -0
- package/publications/cron-jobs.js +88 -0
- package/publications/cron-jobs.js.map +1 -0
- package/publications/customer-notifications.d.ts +2 -0
- package/publications/customer-notifications.js +161 -0
- package/publications/customer-notifications.js.map +1 -0
- package/publications/files.d.ts +2 -0
- package/publications/files.js +36 -0
- package/publications/files.js.map +1 -0
- package/publications/flags-update.d.ts +2 -0
- package/publications/flags-update.js +22 -0
- package/publications/flags-update.js.map +1 -0
- package/publications/flags.d.ts +2 -0
- package/publications/flags.js +22 -0
- package/publications/flags.js.map +1 -0
- package/publications/logs.d.ts +2 -0
- package/publications/logs.js +164 -0
- package/publications/logs.js.map +1 -0
- package/publications/notifications.d.ts +2 -0
- package/publications/notifications.js +16 -0
- package/publications/notifications.js.map +1 -0
- package/publications/report-builder-dashboard-builders.d.ts +2 -0
- package/publications/report-builder-dashboard-builders.js +42 -0
- package/publications/report-builder-dashboard-builders.js.map +1 -0
- package/publications/report-builder-libraries.d.ts +2 -0
- package/publications/report-builder-libraries.js +90 -0
- package/publications/report-builder-libraries.js.map +1 -0
- package/publications/report-builder-reports.d.ts +2 -0
- package/publications/report-builder-reports.js +50 -0
- package/publications/report-builder-reports.js.map +1 -0
- package/publications/super-admin.d.ts +2 -0
- package/publications/super-admin.js +16 -0
- package/publications/super-admin.js.map +1 -0
- package/publications/user-groups.d.ts +1 -0
- package/publications/user-groups.js +16 -0
- package/publications/user-groups.js.map +1 -0
- package/publications/user-guides.d.ts +1 -0
- package/publications/user-guides.js +16 -0
- package/publications/user-guides.js.map +1 -0
- package/resolveio-server-app.d.ts +70 -0
- package/resolveio-server-app.js +801 -0
- package/resolveio-server-app.js.map +1 -0
- package/server-app.d.ts +228 -0
- package/server-app.js +3566 -0
- package/server-app.js.map +1 -0
- package/services/codex-client.d.ts +128 -0
- package/services/codex-client.js +1629 -0
- package/services/codex-client.js.map +1 -0
- package/services/openai-client.d.ts +46 -0
- package/services/openai-client.js +318 -0
- package/services/openai-client.js.map +1 -0
- package/types/error-report.d.ts +25 -0
- package/types/error-report.js +4 -0
- package/types/error-report.js.map +1 -0
- package/types/slow-query-report.d.ts +27 -0
- package/types/slow-query-report.js +6 -0
- package/types/slow-query-report.js.map +1 -0
- package/util/ai-qa-policy.d.ts +124 -0
- package/util/ai-qa-policy.js +736 -0
- package/util/ai-qa-policy.js.map +1 -0
- package/util/ai-run-evidence-adapters.d.ts +109 -0
- package/util/ai-run-evidence-adapters.js +7234 -0
- package/util/ai-run-evidence-adapters.js.map +1 -0
- package/util/ai-run-evidence-dashboard.d.ts +88 -0
- package/util/ai-run-evidence-dashboard.js +343 -0
- package/util/ai-run-evidence-dashboard.js.map +1 -0
- package/util/ai-run-evidence-eval.d.ts +86 -0
- package/util/ai-run-evidence-eval.js +1018 -0
- package/util/ai-run-evidence-eval.js.map +1 -0
- package/util/ai-run-evidence.d.ts +244 -0
- package/util/ai-run-evidence.js +1096 -0
- package/util/ai-run-evidence.js.map +1 -0
- package/util/ai-runner-artifacts.d.ts +82 -0
- package/util/ai-runner-artifacts.js +713 -0
- package/util/ai-runner-artifacts.js.map +1 -0
- package/util/ai-runner-manager-autopilot.d.ts +210 -0
- package/util/ai-runner-manager-autopilot.js +642 -0
- package/util/ai-runner-manager-autopilot.js.map +1 -0
- package/util/ai-runner-manager-policy.d.ts +807 -0
- package/util/ai-runner-manager-policy.js +3501 -0
- package/util/ai-runner-manager-policy.js.map +1 -0
- package/util/ai-runner-qa-auth.d.ts +5 -0
- package/util/ai-runner-qa-auth.js +839 -0
- package/util/ai-runner-qa-auth.js.map +1 -0
- package/util/ai-runner-qa-tools.d.ts +26 -0
- package/util/ai-runner-qa-tools.js +3520 -0
- package/util/ai-runner-qa-tools.js.map +1 -0
- package/util/aicoder-runner-v6.d.ts +426 -0
- package/util/aicoder-runner-v6.js +2464 -0
- package/util/aicoder-runner-v6.js.map +1 -0
- package/util/common.d.ts +31 -0
- package/util/common.js +683 -0
- package/util/common.js.map +1 -0
- package/util/customer-portal-password.d.ts +13 -0
- package/util/customer-portal-password.js +209 -0
- package/util/customer-portal-password.js.map +1 -0
- package/util/error-reporter.d.ts +52 -0
- package/util/error-reporter.js +326 -0
- package/util/error-reporter.js.map +1 -0
- package/util/error-tracking.d.ts +13 -0
- package/util/error-tracking.js +120 -0
- package/util/error-tracking.js.map +1 -0
- package/util/openai-usage-cost.d.ts +6 -0
- package/util/openai-usage-cost.js +103 -0
- package/util/openai-usage-cost.js.map +1 -0
- package/util/report-builder-unwinds.d.ts +15 -0
- package/util/report-builder-unwinds.js +156 -0
- package/util/report-builder-unwinds.js.map +1 -0
- package/util/runner-process-janitor.d.ts +27 -0
- package/util/runner-process-janitor.js +208 -0
- package/util/runner-process-janitor.js.map +1 -0
- package/util/schema-report-builder.d.ts +6 -0
- package/util/schema-report-builder.js +481 -0
- package/util/schema-report-builder.js.map +1 -0
- package/util/slow-query-reporter.d.ts +28 -0
- package/util/slow-query-reporter.js +226 -0
- package/util/slow-query-reporter.js.map +1 -0
- package/util/subscription-dependency-context.d.ts +34 -0
- package/util/subscription-dependency-context.js +1283 -0
- package/util/subscription-dependency-context.js.map +1 -0
- package/util/support-runner-v5.d.ts +1426 -0
- package/util/support-runner-v5.js +7647 -0
- package/util/support-runner-v5.js.map +1 -0
- package/util/tokenizer.d.ts +5 -0
- package/util/tokenizer.js +41 -0
- package/util/tokenizer.js.map +1 -0
- package/workers/codex-runner.worker.d.ts +1 -0
- package/workers/codex-runner.worker.js +192 -0
- package/workers/codex-runner.worker.js.map +1 -0
- package/.nodemon.json +0 -5
- package/.vscode/settings.json +0 -21
- package/AGENTS.md +0 -195
- package/README.md +0 -22
- package/build_package.sh +0 -5
- package/compileDTS.pl +0 -64
- package/docs/ai-assistant-nightly-eval.md +0 -65
- package/docs/ai-assistant-preflight-checklist.md +0 -23
- package/docs/ai-assistant-report-builder-bridge-playbook.md +0 -115
- package/eslint-plugin-custom/index.js +0 -7
- package/eslint-plugin-custom/rules/no-filter-zero-index.js +0 -44
- package/eslint.config.js +0 -103
- package/gulpfile.js +0 -216
- package/methodAndPublicationListGenerator.py +0 -375
- package/mongodbensurers.js +0 -2
- package/mongostop.js +0 -3
- package/scripts/cleanup-bypassed-callmethod-logs.js +0 -616
- package/settings.development.json +0 -25
- package/settings.development.redacted.json +0 -25
- package/src/.env +0 -12
- package/src/ai/assistant-core-heuristics.ts +0 -379
- package/src/ai/resolveio-platform-intelligence-memory-corpus.ts +0 -185
- package/src/ai/resolveio-platform-intelligence-memory.ts +0 -325
- package/src/ai/resolveio-platform-intelligence.ts +0 -462
- package/src/client-server-app.ts +0 -12
- package/src/collections/ai-run.collection.ts +0 -117
- package/src/collections/ai-terminal-conversation.collection.ts +0 -91
- package/src/collections/ai-terminal-issue-report.collection.ts +0 -99
- package/src/collections/ai-terminal-message.collection.ts +0 -77
- package/src/collections/app-setting.collection.ts +0 -104
- package/src/collections/app-status.collection.ts +0 -58
- package/src/collections/communication-metric.collection.ts +0 -84
- package/src/collections/counter.collection.ts +0 -56
- package/src/collections/cron-job-history.collection.ts +0 -94
- package/src/collections/cron-job.collection.ts +0 -92
- package/src/collections/customer-notification.collection.ts +0 -131
- package/src/collections/customer-portal-password.collection.ts +0 -76
- package/src/collections/email-history.collection.ts +0 -134
- package/src/collections/email-verified.collection.ts +0 -62
- package/src/collections/file.collection.ts +0 -74
- package/src/collections/flag-update.collection.ts +0 -57
- package/src/collections/flag.collection.ts +0 -57
- package/src/collections/log-method-latency.collection.ts +0 -77
- package/src/collections/log-subscription.collection.ts +0 -80
- package/src/collections/log.collection.ts +0 -93
- package/src/collections/logged-in-users.collection.ts +0 -67
- package/src/collections/monitor-cpu.collection.ts +0 -65
- package/src/collections/monitor-function.collection.ts +0 -74
- package/src/collections/monitor-memory.collection.ts +0 -77
- package/src/collections/monitor-mongo.collection.ts +0 -71
- package/src/collections/notification.collection.ts +0 -57
- package/src/collections/openai-usage-ledger.collection.ts +0 -131
- package/src/collections/report-builder-dashboard-builder.collection.ts +0 -109
- package/src/collections/report-builder-library.collection.ts +0 -89
- package/src/collections/report-builder-report.collection.ts +0 -184
- package/src/collections/user-group.collection.ts +0 -89
- package/src/collections/user-guide.collection.ts +0 -57
- package/src/collections/user.collection.ts +0 -181
- package/src/cron/cron.ts +0 -117
- package/src/fixtures/cron-jobs.ts +0 -95
- package/src/fixtures/init.ts +0 -35
- package/src/http/auth.ts +0 -818
- package/src/http/health.ts +0 -7
- package/src/http/home.ts +0 -90
- package/src/http/slow-query-publication.ts +0 -49
- package/src/index.ts +0 -1
- package/src/managers/ai-assistant-codex-manager.manager.ts +0 -1131
- package/src/managers/ai-run-evidence.manager.ts +0 -264
- package/src/managers/communication-metric.manager.ts +0 -82
- package/src/managers/cron.manager.ts +0 -333
- package/src/managers/customer-notification-content.manager.ts +0 -236
- package/src/managers/diagnostic-manager-bootstrap.ts +0 -165
- package/src/managers/error-auto-fix.manager.ts +0 -2767
- package/src/managers/local-log.manager.ts +0 -113
- package/src/managers/method.manager.ts +0 -1857
- package/src/managers/mongo.manager.ts +0 -4575
- package/src/managers/monitor.manager.ts +0 -507
- package/src/managers/openai-usage-ledger.manager.ts +0 -112
- package/src/managers/slow-query-verifier.manager.ts +0 -3590
- package/src/managers/slow-query.manager.ts +0 -519
- package/src/managers/subscription.manager.ts +0 -3128
- package/src/managers/websocket.manager.ts +0 -746
- package/src/managers/worker-dispatcher.manager.ts +0 -1360
- package/src/managers/worker-server.manager.ts +0 -536
- package/src/methods/accounts.ts +0 -532
- package/src/methods/ai-terminal.ts +0 -29070
- package/src/methods/app-settings.ts +0 -114
- package/src/methods/aws.ts +0 -649
- package/src/methods/collections.ts +0 -641
- package/src/methods/counters.ts +0 -69
- package/src/methods/cron-jobs.ts +0 -2614
- package/src/methods/customer-notifications.ts +0 -458
- package/src/methods/diagnostics.ts +0 -616
- package/src/methods/flag-updates.ts +0 -7
- package/src/methods/flags.ts +0 -7
- package/src/methods/logs.ts +0 -657
- package/src/methods/mongo-explorer.ts +0 -1880
- package/src/methods/monitor.ts +0 -540
- package/src/methods/pdf.ts +0 -1236
- package/src/methods/publications.ts +0 -129
- package/src/methods/report-builder.ts +0 -3300
- package/src/methods/support.ts +0 -335
- package/src/models/ai-run.model.ts +0 -27
- package/src/models/ai-terminal-conversation.model.ts +0 -19
- package/src/models/ai-terminal-issue-report.model.ts +0 -21
- package/src/models/ai-terminal-message.model.ts +0 -24
- package/src/models/app-setting.model.ts +0 -17
- package/src/models/collection-document.model.ts +0 -24
- package/src/models/communication-metric.model.ts +0 -23
- package/src/models/cron-job-history.model.ts +0 -16
- package/src/models/cron-job.model.ts +0 -15
- package/src/models/customer-notification.model.ts +0 -28
- package/src/models/customer-portal-password.model.ts +0 -12
- package/src/models/dialog.model.ts +0 -25
- package/src/models/log-method-latency.model.ts +0 -11
- package/src/models/log.model.ts +0 -19
- package/src/models/method.model.ts +0 -25
- package/src/models/monitor-function.model.ts +0 -16
- package/src/models/monitor-memory.model.ts +0 -17
- package/src/models/monitor-mongo.model.ts +0 -15
- package/src/models/openai-usage-ledger.model.ts +0 -56
- package/src/models/pagination.model.ts +0 -35
- package/src/models/permission.model.ts +0 -14
- package/src/models/report-builder-dashboard-builder.model.ts +0 -29
- package/src/models/report-builder-library.model.ts +0 -20
- package/src/models/report-builder-report.model.ts +0 -136
- package/src/models/report-builder.model.ts +0 -68
- package/src/models/select-data-label.model.ts +0 -9
- package/src/models/server-message.model.ts +0 -31
- package/src/models/slow-query-report.model.ts +0 -23
- package/src/models/subscription.model.ts +0 -73
- package/src/models/support-ticket.model.ts +0 -104
- package/src/models/user-group.model.ts +0 -24
- package/src/models/user.model.ts +0 -96
- package/src/private/images/ResolveIO.png +0 -0
- package/src/publications/ai-terminal.ts +0 -73
- package/src/publications/app-settings.ts +0 -25
- package/src/publications/app-status.ts +0 -13
- package/src/publications/cron-jobs.ts +0 -40
- package/src/publications/customer-notifications.ts +0 -101
- package/src/publications/files.ts +0 -33
- package/src/publications/flags-update.ts +0 -19
- package/src/publications/flags.ts +0 -19
- package/src/publications/logs.ts +0 -163
- package/src/publications/notifications.ts +0 -13
- package/src/publications/report-builder-dashboard-builders.ts +0 -39
- package/src/publications/report-builder-libraries.ts +0 -41
- package/src/publications/report-builder-reports.ts +0 -47
- package/src/publications/super-admin.ts +0 -13
- package/src/publications/user-groups.ts +0 -12
- package/src/publications/user-guides.ts +0 -12
- package/src/resolveio-server-app.ts +0 -617
- package/src/server-app.ts +0 -3354
- package/src/services/codex-client.ts +0 -1231
- package/src/services/openai-client.ts +0 -265
- package/src/types/error-report.ts +0 -26
- package/src/types/js-tiktoken.d.ts +0 -11
- package/src/types/slow-query-report.ts +0 -28
- package/src/util/ai-qa-policy.ts +0 -925
- package/src/util/ai-run-evidence-adapters.ts +0 -8347
- package/src/util/ai-run-evidence-dashboard.ts +0 -323
- package/src/util/ai-run-evidence-eval.ts +0 -1057
- package/src/util/ai-run-evidence.ts +0 -1430
- package/src/util/ai-runner-artifacts.ts +0 -586
- package/src/util/ai-runner-manager-autopilot.ts +0 -961
- package/src/util/ai-runner-manager-policy.ts +0 -5011
- package/src/util/ai-runner-qa-auth.ts +0 -838
- package/src/util/ai-runner-qa-tools.ts +0 -3536
- package/src/util/aicoder-runner-v6.ts +0 -3121
- package/src/util/common.ts +0 -649
- package/src/util/customer-portal-password.ts +0 -183
- package/src/util/error-reporter.ts +0 -332
- package/src/util/error-tracking.ts +0 -79
- package/src/util/openai-usage-cost.ts +0 -114
- package/src/util/report-builder-unwinds.ts +0 -180
- package/src/util/runner-process-janitor.ts +0 -219
- package/src/util/schema-report-builder.ts +0 -448
- package/src/util/slow-query-reporter.ts +0 -216
- package/src/util/subscription-dependency-context.ts +0 -1096
- package/src/util/support-runner-v5.ts +0 -10040
- package/src/util/tokenizer.ts +0 -38
- package/src/workers/codex-runner.worker.ts +0 -142
- package/start_server.sh +0 -5
- package/tests/ai-assistant-corpus-build.ts +0 -484
- package/tests/ai-assistant-corpus-replay-e2e.ts +0 -774
- package/tests/ai-assistant-data-parity-e2e.ts +0 -1989
- package/tests/ai-assistant-eval-triage.ts +0 -831
- package/tests/ai-assistant-openai-e2e.ts +0 -1061
- package/tests/ai-assistant-openai-git-e2e.ts +0 -155
- package/tests/ai-assistant-preflight-matrix.ts +0 -215
- package/tests/ai-assistant-routing-eval.test.ts +0 -585
- package/tests/ai-assistant-snf-live-eval.ts +0 -975
- package/tests/ai-assistant-utils.test.ts +0 -4834
- package/tests/ai-manager-autopilot-snapshot.test.ts +0 -193
- package/tests/ai-manager-recovery-checkpoint.test.ts +0 -1383
- package/tests/ai-run-eval.test.ts +0 -132
- package/tests/ai-run-evidence.test.ts +0 -3773
- package/tests/ai-runner-contract.test.ts +0 -515
- package/tests/aicoder-runner-v6.test.ts +0 -822
- package/tests/error-reporter.test.ts +0 -145
- package/tests/method-publication-generator.test.ts +0 -46
- package/tests/report-builder-linking.test.ts +0 -79
- package/tests/resolveio-platform-intelligence.test.ts +0 -352
- package/tests/server-app-cron-owner.test.ts +0 -127
- package/tests/subscription-connect-race.test.ts +0 -158
- package/tests/subscription-dependency-context.test.ts +0 -324
- package/tests/subscription-manager-collection-tracking.test.ts +0 -86
- package/tests/subscription-manager-invalidation.test.ts +0 -86
- package/tests/support-runner-v5.test.ts +0 -3201
- package/tsconfig.json +0 -34
- /package/{src/private → private}/email-templates/enrollment.html +0 -0
- /package/{src/private → private}/email-templates/forgot-password.html +0 -0
- /package/{src/private → private}/email-templates/support-ticket-deleted.html +0 -0
- /package/{src/private → private}/email-templates/support-ticket-modified.html +0 -0
- /package/{src/private → private}/email-templates/support-ticket.html +0 -0
- /package/{src/public_api.ts → public_api.d.ts} +0 -0
|
@@ -0,0 +1,2464 @@
|
|
|
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.extractResolveIOAICoderJourneyContractFromMarkdown = extractResolveIOAICoderJourneyContractFromMarkdown;
|
|
51
|
+
exports.buildResolveIOAICoderWorkflowQaRowsFromJourneyContract = buildResolveIOAICoderWorkflowQaRowsFromJourneyContract;
|
|
52
|
+
exports.validateResolveIOAICoderJourneyContract = validateResolveIOAICoderJourneyContract;
|
|
53
|
+
exports.collectResolveIOAICoderJourneyContractIssues = collectResolveIOAICoderJourneyContractIssues;
|
|
54
|
+
exports.evaluateResolveIOAICoderWorkflowProofReadiness = evaluateResolveIOAICoderWorkflowProofReadiness;
|
|
55
|
+
exports.fingerprintResolveIOAICoderV6Blocker = fingerprintResolveIOAICoderV6Blocker;
|
|
56
|
+
exports.buildResolveIOAICoderWorkflowProofCheckpoint = buildResolveIOAICoderWorkflowProofCheckpoint;
|
|
57
|
+
exports.buildResolveIOAICoderV6WorkflowReadiness = buildResolveIOAICoderV6WorkflowReadiness;
|
|
58
|
+
exports.buildResolveIOAICoderNextActionContract = buildResolveIOAICoderNextActionContract;
|
|
59
|
+
exports.buildResolveIOAICoderV6Budget = buildResolveIOAICoderV6Budget;
|
|
60
|
+
exports.initializeResolveIOAICoderV6State = initializeResolveIOAICoderV6State;
|
|
61
|
+
exports.recordResolveIOAICoderV6Step = recordResolveIOAICoderV6Step;
|
|
62
|
+
exports.decideResolveIOAICoderV6Continuation = decideResolveIOAICoderV6Continuation;
|
|
63
|
+
exports.buildResolveIOAICoderV6DiagnoseFirstPrompt = buildResolveIOAICoderV6DiagnoseFirstPrompt;
|
|
64
|
+
exports.buildResolveIOAICoderV6Incident = buildResolveIOAICoderV6Incident;
|
|
65
|
+
var ai_runner_manager_policy_1 = require("./ai-runner-manager-policy");
|
|
66
|
+
var LANES = ['intake', 'plan', 'build', 'qa', 'repair', 'review', 'publish'];
|
|
67
|
+
function isoNow(value) {
|
|
68
|
+
if (value instanceof Date) {
|
|
69
|
+
return value.toISOString();
|
|
70
|
+
}
|
|
71
|
+
var parsed = value ? new Date(value) : new Date();
|
|
72
|
+
if (Number.isFinite(parsed.getTime())) {
|
|
73
|
+
return parsed.toISOString();
|
|
74
|
+
}
|
|
75
|
+
return new Date().toISOString();
|
|
76
|
+
}
|
|
77
|
+
function cleanText(value, max) {
|
|
78
|
+
if (max === void 0) { max = 2000; }
|
|
79
|
+
return String(value || '').replace(/\s+/g, ' ').trim().slice(0, max);
|
|
80
|
+
}
|
|
81
|
+
function cleanList(values, limit, max) {
|
|
82
|
+
var e_1, _a;
|
|
83
|
+
if (limit === void 0) { limit = 20; }
|
|
84
|
+
if (max === void 0) { max = 500; }
|
|
85
|
+
if (!Array.isArray(values)) {
|
|
86
|
+
return [];
|
|
87
|
+
}
|
|
88
|
+
var result = [];
|
|
89
|
+
try {
|
|
90
|
+
for (var values_1 = __values(values), values_1_1 = values_1.next(); !values_1_1.done; values_1_1 = values_1.next()) {
|
|
91
|
+
var value = values_1_1.value;
|
|
92
|
+
var normalized = cleanText(value, max);
|
|
93
|
+
if (normalized && !result.includes(normalized)) {
|
|
94
|
+
result.push(normalized);
|
|
95
|
+
}
|
|
96
|
+
if (result.length >= limit) {
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
102
|
+
finally {
|
|
103
|
+
try {
|
|
104
|
+
if (values_1_1 && !values_1_1.done && (_a = values_1.return)) _a.call(values_1);
|
|
105
|
+
}
|
|
106
|
+
finally { if (e_1) throw e_1.error; }
|
|
107
|
+
}
|
|
108
|
+
return result;
|
|
109
|
+
}
|
|
110
|
+
function readField(source, keys) {
|
|
111
|
+
var e_2, _a;
|
|
112
|
+
if (!source || typeof source !== 'object') {
|
|
113
|
+
return undefined;
|
|
114
|
+
}
|
|
115
|
+
try {
|
|
116
|
+
for (var keys_1 = __values(keys), keys_1_1 = keys_1.next(); !keys_1_1.done; keys_1_1 = keys_1.next()) {
|
|
117
|
+
var key = keys_1_1.value;
|
|
118
|
+
if (source[key] !== undefined && source[key] !== null) {
|
|
119
|
+
return source[key];
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
124
|
+
finally {
|
|
125
|
+
try {
|
|
126
|
+
if (keys_1_1 && !keys_1_1.done && (_a = keys_1.return)) _a.call(keys_1);
|
|
127
|
+
}
|
|
128
|
+
finally { if (e_2) throw e_2.error; }
|
|
129
|
+
}
|
|
130
|
+
return undefined;
|
|
131
|
+
}
|
|
132
|
+
function cleanField(source, keys, max) {
|
|
133
|
+
if (max === void 0) { max = 500; }
|
|
134
|
+
return cleanText(readField(source, keys), max);
|
|
135
|
+
}
|
|
136
|
+
function concatFields(source, keys, maxEach) {
|
|
137
|
+
if (maxEach === void 0) { maxEach = 500; }
|
|
138
|
+
if (!source || typeof source !== 'object') {
|
|
139
|
+
return '';
|
|
140
|
+
}
|
|
141
|
+
return keys
|
|
142
|
+
.map(function (key) { return cleanText(source[key], maxEach); })
|
|
143
|
+
.filter(Boolean)
|
|
144
|
+
.join(' ');
|
|
145
|
+
}
|
|
146
|
+
function asArray(value) {
|
|
147
|
+
if (!Array.isArray(value)) {
|
|
148
|
+
return [];
|
|
149
|
+
}
|
|
150
|
+
return value;
|
|
151
|
+
}
|
|
152
|
+
function stripJsonComments(value) {
|
|
153
|
+
var output = '';
|
|
154
|
+
var inString = false;
|
|
155
|
+
var escaped = false;
|
|
156
|
+
for (var index = 0; index < value.length; index += 1) {
|
|
157
|
+
var char = value[index];
|
|
158
|
+
var next = value[index + 1];
|
|
159
|
+
if (inString) {
|
|
160
|
+
output += char;
|
|
161
|
+
if (escaped) {
|
|
162
|
+
escaped = false;
|
|
163
|
+
}
|
|
164
|
+
else if (char === '\\') {
|
|
165
|
+
escaped = true;
|
|
166
|
+
}
|
|
167
|
+
else if (char === '"') {
|
|
168
|
+
inString = false;
|
|
169
|
+
}
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
if (char === '"') {
|
|
173
|
+
inString = true;
|
|
174
|
+
output += char;
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
if (char === '/' && next === '/') {
|
|
178
|
+
while (index < value.length && value[index] !== '\n') {
|
|
179
|
+
index += 1;
|
|
180
|
+
}
|
|
181
|
+
output += '\n';
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
if (char === '/' && next === '*') {
|
|
185
|
+
index += 2;
|
|
186
|
+
while (index < value.length && !(value[index] === '*' && value[index + 1] === '/')) {
|
|
187
|
+
index += 1;
|
|
188
|
+
}
|
|
189
|
+
index += 1;
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
output += char;
|
|
193
|
+
}
|
|
194
|
+
return output;
|
|
195
|
+
}
|
|
196
|
+
function parseJsonObject(value) {
|
|
197
|
+
try {
|
|
198
|
+
var parsed = JSON.parse(stripJsonComments(value));
|
|
199
|
+
return parsed && typeof parsed === 'object' && !Array.isArray(parsed) ? parsed : null;
|
|
200
|
+
}
|
|
201
|
+
catch (_a) {
|
|
202
|
+
return null;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
function extractResolveIOAICoderJourneyContractFromMarkdown(content) {
|
|
206
|
+
var normalized = String(content || '').replace(/\r\n/g, '\n');
|
|
207
|
+
var sectionMatch = normalized.match(/##\s*journey_contract[\s\S]*?```json\s*([\s\S]*?)```/i)
|
|
208
|
+
|| normalized.match(/##\s*journey_contract[\s\S]*?```\s*([\s\S]*?)```/i);
|
|
209
|
+
if (sectionMatch === null || sectionMatch === void 0 ? void 0 : sectionMatch[1]) {
|
|
210
|
+
return parseJsonObject(sectionMatch[1].trim());
|
|
211
|
+
}
|
|
212
|
+
var fencedMatch = normalized.match(/```json\s*([\s\S]*?)```/i);
|
|
213
|
+
if (fencedMatch === null || fencedMatch === void 0 ? void 0 : fencedMatch[1]) {
|
|
214
|
+
return parseJsonObject(fencedMatch[1].trim());
|
|
215
|
+
}
|
|
216
|
+
var objectMatch = normalized.match(/\{\s*"app_archetype"[\s\S]*\}\s*$/m);
|
|
217
|
+
if (objectMatch === null || objectMatch === void 0 ? void 0 : objectMatch[0]) {
|
|
218
|
+
return parseJsonObject(objectMatch[0].trim());
|
|
219
|
+
}
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
222
|
+
function looksLikeAbsoluteRoute(value) {
|
|
223
|
+
return value.startsWith('/') && !/\s/.test(value);
|
|
224
|
+
}
|
|
225
|
+
function looksPlaceholder(value) {
|
|
226
|
+
return /\b(tbd|todo|placeholder|generic crud|crud-only|lorem ipsum|add details|fill in|coming soon)\b/i.test(value || '');
|
|
227
|
+
}
|
|
228
|
+
function isNavigationOnlyAction(source) {
|
|
229
|
+
var effect = cleanField(source, ['effect', 'outcome', 'state_change', 'expected_state_transition', 'expected_next_state'], 500).toLowerCase();
|
|
230
|
+
var implementation = cleanField(source, [
|
|
231
|
+
'method_or_calculation',
|
|
232
|
+
'server_method_or_publication',
|
|
233
|
+
'local_calculation_path',
|
|
234
|
+
'action_implementation',
|
|
235
|
+
'calculation_path',
|
|
236
|
+
'data_mutation',
|
|
237
|
+
'mutation',
|
|
238
|
+
'persisted_result'
|
|
239
|
+
], 500);
|
|
240
|
+
if (implementation) {
|
|
241
|
+
return false;
|
|
242
|
+
}
|
|
243
|
+
var actionType = cleanField(source, ['action_type', 'type', 'kind'], 120).toLowerCase();
|
|
244
|
+
var actionText = [
|
|
245
|
+
cleanField(source, ['action', 'visible_cta', 'cta', 'label'], 300),
|
|
246
|
+
cleanField(source, ['next_step_destination', 'next_step', 'destination'], 300)
|
|
247
|
+
].join(' ').toLowerCase();
|
|
248
|
+
var navigationSignals = /\b(navigate|go to|open|view|link|route|page)\b/.test(actionText)
|
|
249
|
+
|| /^(?:link|nav|navigation|route)$/i.test(actionType);
|
|
250
|
+
var productiveEffect = /\b(save|saved|create|created|update|updated|calculate|calculated|optimize|optimized|import|export|report|persist|queued|submitted|validated|generated|compare|recommendation|complete|completed)\b/.test(effect);
|
|
251
|
+
return navigationSignals && !productiveEffect;
|
|
252
|
+
}
|
|
253
|
+
function addJourneyIssue(issues, code, path, message, severity) {
|
|
254
|
+
if (severity === void 0) { severity = 'error'; }
|
|
255
|
+
issues.push({ code: code, path: path, message: message, severity: severity });
|
|
256
|
+
}
|
|
257
|
+
function normalizeWorkflowStepPosition(step, index, total) {
|
|
258
|
+
var explicit = cleanField(step, ['position', 'phase', 'order_role'], 60).toLowerCase();
|
|
259
|
+
if (explicit) {
|
|
260
|
+
return explicit;
|
|
261
|
+
}
|
|
262
|
+
if (index === 0) {
|
|
263
|
+
return 'first';
|
|
264
|
+
}
|
|
265
|
+
if (index === total - 1) {
|
|
266
|
+
return 'last';
|
|
267
|
+
}
|
|
268
|
+
return 'next';
|
|
269
|
+
}
|
|
270
|
+
function normalizeJourneyReferenceKey(value) {
|
|
271
|
+
return cleanText(value, 160).toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');
|
|
272
|
+
}
|
|
273
|
+
function normalizeJourneyRouteKey(value) {
|
|
274
|
+
var raw = cleanText(value, 240);
|
|
275
|
+
if (!raw) {
|
|
276
|
+
return '';
|
|
277
|
+
}
|
|
278
|
+
var route = raw.split(/[?#]/)[0].replace(/\/+$/g, '') || '/';
|
|
279
|
+
return route.toLowerCase();
|
|
280
|
+
}
|
|
281
|
+
function normalizeJourneyActionText(value) {
|
|
282
|
+
return cleanText(value, 1000).toLowerCase().replace(/[^a-z0-9]+/g, ' ').trim();
|
|
283
|
+
}
|
|
284
|
+
function buildWorkflowStepId(step, index) {
|
|
285
|
+
return cleanField(step, ['id', 'step_id', 'key'], 120)
|
|
286
|
+
|| cleanField(step, ['label', 'title', 'visible_cta'], 120).toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '')
|
|
287
|
+
|| "step-".concat(index + 1);
|
|
288
|
+
}
|
|
289
|
+
function workflowStepVisibleAction(step) {
|
|
290
|
+
return cleanField(step, ['visible_cta', 'cta', 'label', 'action', 'embedded_hub_action', 'hub_action'], 500);
|
|
291
|
+
}
|
|
292
|
+
function journeySourceVisibleAction(source) {
|
|
293
|
+
return concatFields(source, [
|
|
294
|
+
'visible_cta',
|
|
295
|
+
'cta',
|
|
296
|
+
'label',
|
|
297
|
+
'action',
|
|
298
|
+
'browser_steps',
|
|
299
|
+
'expected_dom_or_data_proof',
|
|
300
|
+
'proof',
|
|
301
|
+
'assertion',
|
|
302
|
+
'expected_result'
|
|
303
|
+
], 700);
|
|
304
|
+
}
|
|
305
|
+
function actionTextReferencesLabel(actionText, label) {
|
|
306
|
+
var action = normalizeJourneyActionText(actionText);
|
|
307
|
+
var expected = normalizeJourneyActionText(label);
|
|
308
|
+
if (!action || !expected || expected.length < 4) {
|
|
309
|
+
return false;
|
|
310
|
+
}
|
|
311
|
+
if (action === expected || action.includes(expected) || expected.includes(action)) {
|
|
312
|
+
return true;
|
|
313
|
+
}
|
|
314
|
+
var actionTokens = new Set(action.split(/\s+/).filter(function (token) { return token.length > 2; }));
|
|
315
|
+
var expectedTokens = expected.split(/\s+/).filter(function (token) { return token.length > 2; });
|
|
316
|
+
if (!expectedTokens.length) {
|
|
317
|
+
return false;
|
|
318
|
+
}
|
|
319
|
+
var matched = expectedTokens.filter(function (token) { return actionTokens.has(token); }).length;
|
|
320
|
+
return matched >= Math.min(expectedTokens.length, Math.max(2, Math.ceil(expectedTokens.length * 0.67)));
|
|
321
|
+
}
|
|
322
|
+
function collectJourneyReferenceKeys(source) {
|
|
323
|
+
var e_3, _a;
|
|
324
|
+
if (!source || typeof source !== 'object') {
|
|
325
|
+
return [];
|
|
326
|
+
}
|
|
327
|
+
var values = [];
|
|
328
|
+
try {
|
|
329
|
+
for (var _b = __values([
|
|
330
|
+
'workflow_step_id',
|
|
331
|
+
'workflowStepId',
|
|
332
|
+
'workflow_step_ids',
|
|
333
|
+
'workflowStepIds',
|
|
334
|
+
'covers_workflow_step_id',
|
|
335
|
+
'coversWorkflowStepId',
|
|
336
|
+
'covers_workflow_step_ids',
|
|
337
|
+
'coversWorkflowStepIds',
|
|
338
|
+
'north_star_step_id',
|
|
339
|
+
'northStarStepId',
|
|
340
|
+
'step_ref',
|
|
341
|
+
'stepRef'
|
|
342
|
+
]), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
343
|
+
var key = _c.value;
|
|
344
|
+
var value = source[key];
|
|
345
|
+
if (Array.isArray(value)) {
|
|
346
|
+
values.push.apply(values, __spreadArray([], __read(value), false));
|
|
347
|
+
}
|
|
348
|
+
else if (value !== undefined && value !== null) {
|
|
349
|
+
values.push(value);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
354
|
+
finally {
|
|
355
|
+
try {
|
|
356
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
357
|
+
}
|
|
358
|
+
finally { if (e_3) throw e_3.error; }
|
|
359
|
+
}
|
|
360
|
+
return Array.from(new Set(values.map(normalizeJourneyReferenceKey).filter(Boolean))).slice(0, 20);
|
|
361
|
+
}
|
|
362
|
+
function journeySourceMapsToWorkflowStep(source, step, index) {
|
|
363
|
+
var stepId = normalizeJourneyReferenceKey(buildWorkflowStepId(step, index));
|
|
364
|
+
var refs = collectJourneyReferenceKeys(source);
|
|
365
|
+
if (stepId && refs.includes(stepId)) {
|
|
366
|
+
return true;
|
|
367
|
+
}
|
|
368
|
+
var sourceRoute = normalizeJourneyRouteKey(cleanField(source, ['route', 'screen_route', 'path'], 240));
|
|
369
|
+
var stepRoute = normalizeJourneyRouteKey(cleanField(step, ['route'], 240));
|
|
370
|
+
if (!sourceRoute || !stepRoute || sourceRoute !== stepRoute) {
|
|
371
|
+
return false;
|
|
372
|
+
}
|
|
373
|
+
return actionTextReferencesLabel(journeySourceVisibleAction(source), workflowStepVisibleAction(step));
|
|
374
|
+
}
|
|
375
|
+
function normalizeWorkflowProofKind(source, fallbackText) {
|
|
376
|
+
if (fallbackText === void 0) { fallbackText = ''; }
|
|
377
|
+
var explicit = cleanField(source, ['proof_kind', 'proofKind', 'qa_proof_kind', 'qaProofKind', 'type', 'kind'], 120).toLowerCase().replace(/[\s-]+/g, '_');
|
|
378
|
+
if (explicit) {
|
|
379
|
+
return explicit;
|
|
380
|
+
}
|
|
381
|
+
var text = cleanText([
|
|
382
|
+
fallbackText,
|
|
383
|
+
concatFields(source, ['id', 'step_id', 'stepId', 'action', 'browser_steps', 'expected_dom_or_data_proof', 'proof', 'expected_result', 'viewport'], 700)
|
|
384
|
+
].filter(Boolean).join(' '), 1800).toLowerCase();
|
|
385
|
+
if (/\b(mobile|390x844|viewport)\b/.test(text)) {
|
|
386
|
+
return 'mobile';
|
|
387
|
+
}
|
|
388
|
+
if (/\b(export|report|pdf|download)\b/.test(text)) {
|
|
389
|
+
return 'report_export';
|
|
390
|
+
}
|
|
391
|
+
if (/\b(complete|saved|save|result|recommendation|calculated|optimized|final)\b/.test(text)) {
|
|
392
|
+
return 'workflow_completion';
|
|
393
|
+
}
|
|
394
|
+
if (/\b(sample|seeded|non[-\s]?empty|kpi|table|chart|record|row)\b/.test(text)) {
|
|
395
|
+
return 'non_empty_data';
|
|
396
|
+
}
|
|
397
|
+
if (/\b(empty|error|recovery|invalid)\b/.test(text)) {
|
|
398
|
+
return 'recovery';
|
|
399
|
+
}
|
|
400
|
+
if (/\b(hub|dashboard|command center|next up|queue)\b/.test(text)) {
|
|
401
|
+
return 'hub_action';
|
|
402
|
+
}
|
|
403
|
+
return 'business_workflow';
|
|
404
|
+
}
|
|
405
|
+
function normalizeWorkflowQaCoverageTag(value) {
|
|
406
|
+
var normalized = cleanText(value, 120).toLowerCase().replace(/[^a-z0-9]+/g, '_').replace(/^_+|_+$/g, '');
|
|
407
|
+
if (!normalized) {
|
|
408
|
+
return '';
|
|
409
|
+
}
|
|
410
|
+
var aliases = {
|
|
411
|
+
auth: 'login',
|
|
412
|
+
authentication: 'login',
|
|
413
|
+
authenticated_session: 'login',
|
|
414
|
+
signed_in: 'login',
|
|
415
|
+
dashboard: 'hub_action',
|
|
416
|
+
dashboard_hub: 'hub_action',
|
|
417
|
+
hub: 'hub_action',
|
|
418
|
+
primary_hub_action: 'hub_action',
|
|
419
|
+
command_center: 'hub_action',
|
|
420
|
+
embedded_hub_action: 'hub_action',
|
|
421
|
+
completion: 'workflow_completion',
|
|
422
|
+
business_completion: 'workflow_completion',
|
|
423
|
+
final_result: 'workflow_completion',
|
|
424
|
+
result: 'workflow_completion',
|
|
425
|
+
saved_result: 'workflow_completion',
|
|
426
|
+
saved_output: 'workflow_completion',
|
|
427
|
+
calculated_result: 'workflow_completion',
|
|
428
|
+
export: 'report_export',
|
|
429
|
+
report: 'report_export',
|
|
430
|
+
pdf_export: 'report_export',
|
|
431
|
+
report_download: 'report_export',
|
|
432
|
+
sample_data: 'non_empty_data',
|
|
433
|
+
seed_data: 'non_empty_data',
|
|
434
|
+
seeded_data: 'non_empty_data',
|
|
435
|
+
non_empty: 'non_empty_data',
|
|
436
|
+
nonempty: 'non_empty_data',
|
|
437
|
+
kpi_data: 'non_empty_data',
|
|
438
|
+
responsive: 'mobile',
|
|
439
|
+
responsive_mobile: 'mobile',
|
|
440
|
+
mobile_viewport: 'mobile',
|
|
441
|
+
phone: 'mobile',
|
|
442
|
+
empty_state: 'recovery',
|
|
443
|
+
error_state: 'recovery',
|
|
444
|
+
error_recovery: 'recovery',
|
|
445
|
+
empty_error_recovery: 'recovery',
|
|
446
|
+
invalid_input_recovery: 'recovery'
|
|
447
|
+
};
|
|
448
|
+
return aliases[normalized] || normalized;
|
|
449
|
+
}
|
|
450
|
+
function appendWorkflowQaCoverageValues(target, value) {
|
|
451
|
+
var e_4, _a, e_5, _b;
|
|
452
|
+
if (Array.isArray(value)) {
|
|
453
|
+
value.forEach(function (entry) { return appendWorkflowQaCoverageValues(target, entry); });
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
if (value && typeof value === 'object') {
|
|
457
|
+
try {
|
|
458
|
+
for (var _c = __values(Object.entries(value)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
459
|
+
var _e = __read(_d.value, 2), key = _e[0], entry = _e[1];
|
|
460
|
+
if (entry === true) {
|
|
461
|
+
target.push(normalizeWorkflowQaCoverageTag(key));
|
|
462
|
+
}
|
|
463
|
+
else if (typeof entry === 'string' || Array.isArray(entry) || (entry && typeof entry === 'object')) {
|
|
464
|
+
appendWorkflowQaCoverageValues(target, entry);
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
469
|
+
finally {
|
|
470
|
+
try {
|
|
471
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
472
|
+
}
|
|
473
|
+
finally { if (e_4) throw e_4.error; }
|
|
474
|
+
}
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
var text = cleanText(value, 500);
|
|
478
|
+
if (!text) {
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
try {
|
|
482
|
+
for (var _f = __values(text.split(/[|,;]/)), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
483
|
+
var entry = _g.value;
|
|
484
|
+
target.push(normalizeWorkflowQaCoverageTag(entry));
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
488
|
+
finally {
|
|
489
|
+
try {
|
|
490
|
+
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
491
|
+
}
|
|
492
|
+
finally { if (e_5) throw e_5.error; }
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
function normalizeWorkflowQaCoverageTags(source, options) {
|
|
496
|
+
var e_6, _a, e_7, _b;
|
|
497
|
+
if (options === void 0) { options = {}; }
|
|
498
|
+
var tags = [];
|
|
499
|
+
try {
|
|
500
|
+
for (var _c = __values([
|
|
501
|
+
'coverage',
|
|
502
|
+
'coverage_tags',
|
|
503
|
+
'coverageTags',
|
|
504
|
+
'qa_coverage',
|
|
505
|
+
'qaCoverage',
|
|
506
|
+
'required_coverage',
|
|
507
|
+
'requiredCoverage',
|
|
508
|
+
'business_coverage',
|
|
509
|
+
'businessCoverage'
|
|
510
|
+
]), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
511
|
+
var key = _d.value;
|
|
512
|
+
appendWorkflowQaCoverageValues(tags, readField(source, [key]));
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
516
|
+
finally {
|
|
517
|
+
try {
|
|
518
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
519
|
+
}
|
|
520
|
+
finally { if (e_6) throw e_6.error; }
|
|
521
|
+
}
|
|
522
|
+
if (options.includeProofKind !== false) {
|
|
523
|
+
try {
|
|
524
|
+
for (var _e = __values(['proof_kind', 'proofKind', 'proof_kinds', 'proofKinds']), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
525
|
+
var key = _f.value;
|
|
526
|
+
appendWorkflowQaCoverageValues(tags, readField(source, [key]));
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
530
|
+
finally {
|
|
531
|
+
try {
|
|
532
|
+
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
533
|
+
}
|
|
534
|
+
finally { if (e_7) throw e_7.error; }
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
return Array.from(new Set(tags.filter(Boolean))).slice(0, 20);
|
|
538
|
+
}
|
|
539
|
+
function buildWorkflowQaRequiredArtifacts(source, proofKind) {
|
|
540
|
+
var explicit = cleanList(readField(source, ['required_artifacts', 'requiredArtifacts', 'proof_artifacts', 'artifact_expectation', 'artifacts_required']), 12, 180);
|
|
541
|
+
var defaultsByKind = {
|
|
542
|
+
login: ['authenticated session proof', 'post-login hub route proof'],
|
|
543
|
+
hub_action: ['hub screenshot or DOM snapshot', 'next action state proof'],
|
|
544
|
+
workflow_completion: ['before/action/after trace', 'saved or calculated output proof', 'business assertion artifact'],
|
|
545
|
+
report_export: ['generated report/export artifact', 'export control proof', 'saved output row proof'],
|
|
546
|
+
non_empty_data: ['seeded data snapshot', 'non-empty KPI/table/chart proof'],
|
|
547
|
+
mobile: ['mobile viewport screenshot or trace', 'responsive workflow action proof'],
|
|
548
|
+
recovery: ['empty/error state screenshot or trace', 'recovery action proof'],
|
|
549
|
+
business_workflow: ['browser trace or screenshot', 'DOM/data assertion artifact']
|
|
550
|
+
};
|
|
551
|
+
return Array.from(new Set(__spreadArray(__spreadArray([], __read(explicit), false), __read((defaultsByKind[proofKind] || defaultsByKind.business_workflow)), false))).slice(0, 16);
|
|
552
|
+
}
|
|
553
|
+
function buildWorkflowQaStateTransition(source, fallback) {
|
|
554
|
+
if (fallback === void 0) { fallback = {}; }
|
|
555
|
+
return {
|
|
556
|
+
before: cleanField(source, ['before', 'setup_state', 'initial_state'], 700) || fallback.expectedState,
|
|
557
|
+
action: cleanField(source, ['action', 'browser_steps', 'visible_cta', 'cta'], 700) || fallback.action,
|
|
558
|
+
after: cleanField(source, ['after', 'expected_state', 'expected_result', 'expected_dom_or_data_proof', 'proof'], 700) || fallback.assertion || fallback.expectedState,
|
|
559
|
+
assertion: cleanField(source, ['assertion', 'expected_dom_or_data_proof', 'proof', 'expected_result'], 700) || fallback.assertion
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
function buildResolveIOAICoderWorkflowQaRowsFromJourneyContract(input) {
|
|
563
|
+
var contract = typeof input === 'string'
|
|
564
|
+
? extractResolveIOAICoderJourneyContractFromMarkdown(input)
|
|
565
|
+
: (input && typeof input === 'object' && !Array.isArray(input) ? input : null);
|
|
566
|
+
if (!contract) {
|
|
567
|
+
return [];
|
|
568
|
+
}
|
|
569
|
+
var workflowId = cleanField(contract, ['primary_workflow_id', 'workflow_id', 'id'], 160) || 'north-star';
|
|
570
|
+
var rows = [];
|
|
571
|
+
var qaAssertions = asArray(contract.qa_assertions);
|
|
572
|
+
qaAssertions.forEach(function (assertion, index) {
|
|
573
|
+
if (!assertion || typeof assertion !== 'object' || Array.isArray(assertion)) {
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
var route = cleanField(assertion, ['route', 'screen_route', 'path'], 240);
|
|
577
|
+
var action = cleanField(assertion, ['action', 'browser_steps', 'cta', 'visible_cta'], 500);
|
|
578
|
+
var expectedState = cleanField(assertion, ['expected_state', 'expected_result', 'expected_dom_or_data_proof', 'proof'], 500);
|
|
579
|
+
var assertionText = cleanField(assertion, ['assertion', 'expected_dom_or_data_proof', 'proof', 'expected_result'], 700);
|
|
580
|
+
if (!route && !action && !assertionText) {
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
583
|
+
var proofKind = normalizeWorkflowProofKind(assertion);
|
|
584
|
+
var coverageTags = normalizeWorkflowQaCoverageTags(assertion);
|
|
585
|
+
var rowBase = {
|
|
586
|
+
route: route || undefined,
|
|
587
|
+
action: action || undefined,
|
|
588
|
+
assertion: assertionText || undefined,
|
|
589
|
+
expectedState: expectedState || undefined
|
|
590
|
+
};
|
|
591
|
+
rows.push(__assign(__assign({ index: cleanNumber(readField(assertion, ['index', 'order'])) || index + 1, workflowId: cleanField(assertion, ['workflow_id', 'workflowId'], 160) || workflowId, workflowStepId: cleanField(assertion, [
|
|
592
|
+
'workflow_step_id',
|
|
593
|
+
'workflowStepId',
|
|
594
|
+
'covers_workflow_step_id',
|
|
595
|
+
'coversWorkflowStepId',
|
|
596
|
+
'north_star_step_id',
|
|
597
|
+
'northStarStepId'
|
|
598
|
+
], 160) || undefined, workflowStepIds: collectJourneyReferenceKeys(assertion), stepId: cleanField(assertion, ['step_id', 'stepId', 'id'], 160) || "qa-".concat(index + 1) }, rowBase), { expectedOutput: cleanField(assertion, ['expected_output', 'expectedOutput', 'saved_output', 'calculated_output', 'report_output'], 700) || expectedState || assertionText || undefined, proofKind: proofKind, coverageTags: coverageTags, acceptanceGate: 'aiqa_business_assertion', requiredArtifacts: buildWorkflowQaRequiredArtifacts(assertion, proofKind), stateTransition: buildWorkflowQaStateTransition(assertion, rowBase), status: cleanField(assertion, ['status'], 120) || undefined, artifactPaths: cleanList(readField(assertion, ['artifact_paths', 'artifactPaths']), 20, 500) }));
|
|
599
|
+
});
|
|
600
|
+
if (rows.length) {
|
|
601
|
+
return rows.slice(0, 80);
|
|
602
|
+
}
|
|
603
|
+
asArray(contract.north_star_workflow).forEach(function (step, index, workflow) {
|
|
604
|
+
if (!step || typeof step !== 'object' || Array.isArray(step)) {
|
|
605
|
+
return;
|
|
606
|
+
}
|
|
607
|
+
var proofKind = normalizeWorkflowProofKind(step, normalizeWorkflowStepPosition(step, index, workflow.length));
|
|
608
|
+
var rowBase = {
|
|
609
|
+
route: cleanField(step, ['route'], 240) || undefined,
|
|
610
|
+
action: cleanField(step, ['visible_cta', 'action', 'cta'], 500) || undefined,
|
|
611
|
+
assertion: cleanField(step, ['success_confirmation', 'expected_state_transition', 'final_result'], 700) || undefined,
|
|
612
|
+
expectedState: cleanField(step, ['expected_state_transition', 'success_confirmation', 'final_result'], 500) || undefined
|
|
613
|
+
};
|
|
614
|
+
rows.push(__assign(__assign({ index: index + 1, workflowId: workflowId, workflowStepId: buildWorkflowStepId(step, index), workflowStepIds: [buildWorkflowStepId(step, index)], stepId: buildWorkflowStepId(step, index) }, rowBase), { expectedOutput: cleanField(step, ['final_result', 'saved_exported_reported_result', 'completion_result', 'expected_state_transition'], 700) || rowBase.expectedState || rowBase.assertion, proofKind: proofKind, coverageTags: Array.from(new Set([proofKind, normalizeWorkflowStepPosition(step, index, workflow.length)].map(normalizeWorkflowQaCoverageTag).filter(Boolean))), acceptanceGate: 'aiqa_business_assertion', requiredArtifacts: buildWorkflowQaRequiredArtifacts(step, proofKind), stateTransition: buildWorkflowQaStateTransition(step, rowBase), status: undefined, artifactPaths: [] }));
|
|
615
|
+
void workflow;
|
|
616
|
+
});
|
|
617
|
+
return rows.slice(0, 80);
|
|
618
|
+
}
|
|
619
|
+
function validateResolveIOAICoderJourneyContract(input, options) {
|
|
620
|
+
var e_8, _a, e_9, _b, e_10, _c, e_11, _d;
|
|
621
|
+
if (options === void 0) { options = {}; }
|
|
622
|
+
var pathLabel = cleanText(options.pathLabel || 'docs/APP_JOURNEY_CONTRACT.md', 240) || 'docs/APP_JOURNEY_CONTRACT.md';
|
|
623
|
+
var issues = [];
|
|
624
|
+
var contract = null;
|
|
625
|
+
if (typeof input === 'string') {
|
|
626
|
+
var normalized = input.replace(/\r\n/g, '\n');
|
|
627
|
+
if (!normalized.trim()) {
|
|
628
|
+
addJourneyIssue(issues, 'missing_contract', pathLabel, "".concat(pathLabel, ": missing app journey contract."));
|
|
629
|
+
return { valid: false, contract: null, issues: issues, workflowQaRows: [], primaryWorkflowId: '' };
|
|
630
|
+
}
|
|
631
|
+
if (options.requireMarkdownEnvelope !== false && !/^\s*#\s+App Journey Contract/im.test(normalized)) {
|
|
632
|
+
addJourneyIssue(issues, 'missing_heading', pathLabel, "".concat(pathLabel, ": missing \"# App Journey Contract\" heading."));
|
|
633
|
+
}
|
|
634
|
+
if (options.requireMarkdownEnvelope !== false && !/##\s*journey_contract/i.test(normalized)) {
|
|
635
|
+
addJourneyIssue(issues, 'missing_json_section', pathLabel, "".concat(pathLabel, ": missing \"## journey_contract\" JSON section."));
|
|
636
|
+
}
|
|
637
|
+
if (looksPlaceholder(normalized)) {
|
|
638
|
+
addJourneyIssue(issues, 'placeholder_text', pathLabel, "".concat(pathLabel, ": contains placeholder or generic journey text."));
|
|
639
|
+
}
|
|
640
|
+
contract = extractResolveIOAICoderJourneyContractFromMarkdown(normalized);
|
|
641
|
+
}
|
|
642
|
+
else if (input && typeof input === 'object' && !Array.isArray(input)) {
|
|
643
|
+
contract = input;
|
|
644
|
+
}
|
|
645
|
+
if (!contract) {
|
|
646
|
+
addJourneyIssue(issues, 'invalid_json', pathLabel, "".concat(pathLabel, ": journey_contract JSON is missing or invalid."));
|
|
647
|
+
return { valid: false, contract: null, issues: issues, workflowQaRows: [], primaryWorkflowId: '' };
|
|
648
|
+
}
|
|
649
|
+
var requiredKeys = [
|
|
650
|
+
'app_archetype',
|
|
651
|
+
'primary_actor',
|
|
652
|
+
'primary_goal',
|
|
653
|
+
'first_screen',
|
|
654
|
+
'north_star_workflow',
|
|
655
|
+
'secondary_workflows',
|
|
656
|
+
'screen_sequence',
|
|
657
|
+
'data_story',
|
|
658
|
+
'completion_states',
|
|
659
|
+
'qa_assertions'
|
|
660
|
+
];
|
|
661
|
+
try {
|
|
662
|
+
for (var requiredKeys_1 = __values(requiredKeys), requiredKeys_1_1 = requiredKeys_1.next(); !requiredKeys_1_1.done; requiredKeys_1_1 = requiredKeys_1.next()) {
|
|
663
|
+
var key = requiredKeys_1_1.value;
|
|
664
|
+
if (!(key in contract)) {
|
|
665
|
+
addJourneyIssue(issues, 'missing_key', "".concat(pathLabel, ".journey_contract.").concat(key), "".concat(pathLabel, ": journey_contract missing key \"").concat(key, "\"."));
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
670
|
+
finally {
|
|
671
|
+
try {
|
|
672
|
+
if (requiredKeys_1_1 && !requiredKeys_1_1.done && (_a = requiredKeys_1.return)) _a.call(requiredKeys_1);
|
|
673
|
+
}
|
|
674
|
+
finally { if (e_8) throw e_8.error; }
|
|
675
|
+
}
|
|
676
|
+
try {
|
|
677
|
+
for (var _e = __values(['app_archetype', 'primary_actor', 'primary_goal']), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
678
|
+
var key = _f.value;
|
|
679
|
+
var value = cleanText(contract[key], 500);
|
|
680
|
+
if (value.length < 4) {
|
|
681
|
+
addJourneyIssue(issues, 'empty_core_field', "".concat(pathLabel, ".journey_contract.").concat(key), "".concat(pathLabel, ": journey_contract.").concat(key, " must be non-empty."));
|
|
682
|
+
}
|
|
683
|
+
if (looksPlaceholder(value)) {
|
|
684
|
+
addJourneyIssue(issues, 'placeholder_core_field', "".concat(pathLabel, ".journey_contract.").concat(key), "".concat(pathLabel, ": journey_contract.").concat(key, " is placeholder text."));
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
689
|
+
finally {
|
|
690
|
+
try {
|
|
691
|
+
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
692
|
+
}
|
|
693
|
+
finally { if (e_9) throw e_9.error; }
|
|
694
|
+
}
|
|
695
|
+
var firstScreen = contract.first_screen;
|
|
696
|
+
if (!firstScreen || typeof firstScreen !== 'object' || Array.isArray(firstScreen)) {
|
|
697
|
+
addJourneyIssue(issues, 'invalid_first_screen', "".concat(pathLabel, ".journey_contract.first_screen"), "".concat(pathLabel, ": first_screen must be an object."));
|
|
698
|
+
}
|
|
699
|
+
else {
|
|
700
|
+
var route = cleanField(firstScreen, ['route'], 240);
|
|
701
|
+
try {
|
|
702
|
+
for (var _g = __values([
|
|
703
|
+
['route', ['route']],
|
|
704
|
+
['purpose', ['purpose', 'screen_purpose']],
|
|
705
|
+
['visible_cta', ['visible_cta', 'cta', 'primary_cta']],
|
|
706
|
+
['next_step', ['next_step', 'next_step_destination', 'expected_next_state']]
|
|
707
|
+
]), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
708
|
+
var _j = __read(_h.value, 2), label = _j[0], keys = _j[1];
|
|
709
|
+
if (cleanField(firstScreen, keys, 500).length < 4) {
|
|
710
|
+
addJourneyIssue(issues, 'incomplete_first_screen', "".concat(pathLabel, ".journey_contract.first_screen.").concat(label), "".concat(pathLabel, ": first_screen.").concat(label, " must be non-empty."));
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
715
|
+
finally {
|
|
716
|
+
try {
|
|
717
|
+
if (_h && !_h.done && (_c = _g.return)) _c.call(_g);
|
|
718
|
+
}
|
|
719
|
+
finally { if (e_10) throw e_10.error; }
|
|
720
|
+
}
|
|
721
|
+
if (route && !looksLikeAbsoluteRoute(route)) {
|
|
722
|
+
addJourneyIssue(issues, 'relative_first_screen_route', "".concat(pathLabel, ".journey_contract.first_screen.route"), "".concat(pathLabel, ": first_screen.route must be an absolute app route."));
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
var workflow = asArray(contract.north_star_workflow);
|
|
726
|
+
if (workflow.length < 3) {
|
|
727
|
+
addJourneyIssue(issues, 'workflow_too_short', "".concat(pathLabel, ".journey_contract.north_star_workflow"), "".concat(pathLabel, ": north_star_workflow must include at least first, next, and last steps."));
|
|
728
|
+
}
|
|
729
|
+
var positions = new Set(workflow.map(function (step, index) { return normalizeWorkflowStepPosition(step, index, workflow.length); }));
|
|
730
|
+
try {
|
|
731
|
+
for (var _k = __values(['first', 'next', 'last']), _l = _k.next(); !_l.done; _l = _k.next()) {
|
|
732
|
+
var requiredPosition = _l.value;
|
|
733
|
+
if (!positions.has(requiredPosition)) {
|
|
734
|
+
addJourneyIssue(issues, 'missing_workflow_position', "".concat(pathLabel, ".journey_contract.north_star_workflow"), "".concat(pathLabel, ": north_star_workflow missing position \"").concat(requiredPosition, "\"."));
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
739
|
+
finally {
|
|
740
|
+
try {
|
|
741
|
+
if (_l && !_l.done && (_d = _k.return)) _d.call(_k);
|
|
742
|
+
}
|
|
743
|
+
finally { if (e_11) throw e_11.error; }
|
|
744
|
+
}
|
|
745
|
+
workflow.forEach(function (step, index) {
|
|
746
|
+
var e_12, _a;
|
|
747
|
+
var stepPath = "".concat(pathLabel, ".journey_contract.north_star_workflow[").concat(index, "]");
|
|
748
|
+
if (!step || typeof step !== 'object' || Array.isArray(step)) {
|
|
749
|
+
addJourneyIssue(issues, 'invalid_workflow_step', stepPath, "".concat(pathLabel, ": north_star_workflow[").concat(index, "] must be an object."));
|
|
750
|
+
return;
|
|
751
|
+
}
|
|
752
|
+
var position = normalizeWorkflowStepPosition(step, index, workflow.length);
|
|
753
|
+
var route = cleanField(step, ['route'], 240);
|
|
754
|
+
var embeddedAction = cleanField(step, ['embedded_hub_action', 'hub_action'], 240);
|
|
755
|
+
var implementation = cleanField(step, [
|
|
756
|
+
'method_or_calculation',
|
|
757
|
+
'server_method_or_publication',
|
|
758
|
+
'local_calculation_path',
|
|
759
|
+
'action_implementation',
|
|
760
|
+
'calculation_path',
|
|
761
|
+
'data_mutation',
|
|
762
|
+
'mutation',
|
|
763
|
+
'persisted_result'
|
|
764
|
+
], 500);
|
|
765
|
+
var requiredStepFields = [
|
|
766
|
+
['position', ['position']],
|
|
767
|
+
['visible_cta', ['visible_cta', 'cta', 'label']],
|
|
768
|
+
['data_input_or_selection', ['data_input_or_selection', 'data_input', 'selection', 'input']],
|
|
769
|
+
['expected_state_transition', ['expected_state_transition', 'expected_next_state', 'state_change']],
|
|
770
|
+
['success_confirmation', ['success_confirmation', 'confirmation', 'success_message']],
|
|
771
|
+
['next_step_destination', ['next_step_destination', 'next_step', 'destination']]
|
|
772
|
+
];
|
|
773
|
+
try {
|
|
774
|
+
for (var requiredStepFields_1 = __values(requiredStepFields), requiredStepFields_1_1 = requiredStepFields_1.next(); !requiredStepFields_1_1.done; requiredStepFields_1_1 = requiredStepFields_1.next()) {
|
|
775
|
+
var _b = __read(requiredStepFields_1_1.value, 2), fieldName = _b[0], keys = _b[1];
|
|
776
|
+
if (fieldName === 'next_step_destination' && position === 'last') {
|
|
777
|
+
continue;
|
|
778
|
+
}
|
|
779
|
+
if (cleanField(step, keys, 500).length < 3) {
|
|
780
|
+
addJourneyIssue(issues, 'incomplete_workflow_step', "".concat(stepPath, ".").concat(fieldName), "".concat(pathLabel, ": north_star_workflow[").concat(index, "].").concat(fieldName, " must be non-empty."));
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
785
|
+
finally {
|
|
786
|
+
try {
|
|
787
|
+
if (requiredStepFields_1_1 && !requiredStepFields_1_1.done && (_a = requiredStepFields_1.return)) _a.call(requiredStepFields_1);
|
|
788
|
+
}
|
|
789
|
+
finally { if (e_12) throw e_12.error; }
|
|
790
|
+
}
|
|
791
|
+
if (!route && !embeddedAction) {
|
|
792
|
+
addJourneyIssue(issues, 'workflow_step_missing_route_or_hub_action', stepPath, "".concat(pathLabel, ": north_star_workflow[").concat(index, "] must specify a route or embedded hub action."));
|
|
793
|
+
}
|
|
794
|
+
if (route && !looksLikeAbsoluteRoute(route)) {
|
|
795
|
+
addJourneyIssue(issues, 'relative_workflow_route', "".concat(stepPath, ".route"), "".concat(pathLabel, ": north_star_workflow[").concat(index, "].route must be an absolute app route."));
|
|
796
|
+
}
|
|
797
|
+
if (!implementation) {
|
|
798
|
+
addJourneyIssue(issues, 'workflow_step_missing_implementation', stepPath, "".concat(pathLabel, ": north_star_workflow[").concat(index, "] must map the CTA to a server method, publication, local calculation, persisted mutation, or export/report action."));
|
|
799
|
+
}
|
|
800
|
+
if (isNavigationOnlyAction(step)) {
|
|
801
|
+
addJourneyIssue(issues, 'navigation_only_workflow_step', stepPath, "".concat(pathLabel, ": north_star_workflow[").concat(index, "] appears to be navigation-only instead of advancing state."));
|
|
802
|
+
}
|
|
803
|
+
if (position === 'last' && cleanField(step, ['final_result', 'saved_exported_reported_result', 'completion_result'], 700).length < 8) {
|
|
804
|
+
addJourneyIssue(issues, 'last_step_missing_final_result', "".concat(stepPath, ".final_result"), "".concat(pathLabel, ": last workflow step must define the saved, exported, reported, or calculated final result."));
|
|
805
|
+
}
|
|
806
|
+
});
|
|
807
|
+
var secondaryWorkflows = asArray(contract.secondary_workflows);
|
|
808
|
+
if (secondaryWorkflows.length < 3) {
|
|
809
|
+
addJourneyIssue(issues, 'missing_secondary_workflows', "".concat(pathLabel, ".journey_contract.secondary_workflows"), "".concat(pathLabel, ": secondary_workflows must include setup, manage, report/export, settings/secrets, or recovery coverage."));
|
|
810
|
+
}
|
|
811
|
+
var screenSequence = asArray(contract.screen_sequence);
|
|
812
|
+
if (screenSequence.length < Math.min(3, Math.max(workflow.length, 3))) {
|
|
813
|
+
addJourneyIssue(issues, 'screen_sequence_too_short', "".concat(pathLabel, ".journey_contract.screen_sequence"), "".concat(pathLabel, ": screen_sequence must map workflow steps to routes, CTAs, data, and next state."));
|
|
814
|
+
}
|
|
815
|
+
screenSequence.forEach(function (screen, index) {
|
|
816
|
+
var e_13, _a;
|
|
817
|
+
var screenPath = "".concat(pathLabel, ".journey_contract.screen_sequence[").concat(index, "]");
|
|
818
|
+
if (!screen || typeof screen !== 'object' || Array.isArray(screen)) {
|
|
819
|
+
addJourneyIssue(issues, 'invalid_screen_sequence_row', screenPath, "".concat(pathLabel, ": screen_sequence[").concat(index, "] must be an object."));
|
|
820
|
+
return;
|
|
821
|
+
}
|
|
822
|
+
try {
|
|
823
|
+
for (var _b = __values([
|
|
824
|
+
['route', ['route']],
|
|
825
|
+
['screen_purpose', ['screen_purpose', 'purpose']],
|
|
826
|
+
['visible_cta', ['visible_cta', 'cta']],
|
|
827
|
+
['expected_next_state', ['expected_next_state', 'expected_state_transition']],
|
|
828
|
+
['data_shown', ['data_shown', 'data', 'records_shown']]
|
|
829
|
+
]), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
830
|
+
var _d = __read(_c.value, 2), fieldName = _d[0], keys = _d[1];
|
|
831
|
+
if (cleanField(screen, keys, 500).length < 3) {
|
|
832
|
+
addJourneyIssue(issues, 'incomplete_screen_sequence_row', "".concat(screenPath, ".").concat(fieldName), "".concat(pathLabel, ": screen_sequence[").concat(index, "].").concat(fieldName, " must be non-empty."));
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
catch (e_13_1) { e_13 = { error: e_13_1 }; }
|
|
837
|
+
finally {
|
|
838
|
+
try {
|
|
839
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
840
|
+
}
|
|
841
|
+
finally { if (e_13) throw e_13.error; }
|
|
842
|
+
}
|
|
843
|
+
var route = cleanField(screen, ['route'], 240);
|
|
844
|
+
if (route && !looksLikeAbsoluteRoute(route)) {
|
|
845
|
+
addJourneyIssue(issues, 'relative_screen_route', "".concat(screenPath, ".route"), "".concat(pathLabel, ": screen_sequence[").concat(index, "].route must be an absolute app route."));
|
|
846
|
+
}
|
|
847
|
+
if (isNavigationOnlyAction(screen)) {
|
|
848
|
+
addJourneyIssue(issues, 'navigation_only_screen_action', screenPath, "".concat(pathLabel, ": screen_sequence[").concat(index, "] CTA appears to navigate without changing workflow state."));
|
|
849
|
+
}
|
|
850
|
+
if (workflow.length && !workflow.some(function (step, workflowIndex) { return journeySourceMapsToWorkflowStep(screen, step, workflowIndex); })) {
|
|
851
|
+
addJourneyIssue(issues, 'screen_sequence_unmapped_to_workflow', screenPath, "".concat(pathLabel, ": screen_sequence[").concat(index, "] must reference a north_star_workflow step by workflow_step_id or match that step's route and CTA."));
|
|
852
|
+
}
|
|
853
|
+
});
|
|
854
|
+
workflow.forEach(function (step, index) {
|
|
855
|
+
if (!step || typeof step !== 'object' || Array.isArray(step)) {
|
|
856
|
+
return;
|
|
857
|
+
}
|
|
858
|
+
var stepPath = "".concat(pathLabel, ".journey_contract.north_star_workflow[").concat(index, "]");
|
|
859
|
+
var matchingScreens = screenSequence.filter(function (screen) { return journeySourceMapsToWorkflowStep(screen, step, index); });
|
|
860
|
+
if (!matchingScreens.length) {
|
|
861
|
+
addJourneyIssue(issues, 'workflow_step_missing_screen_mapping', stepPath, "".concat(pathLabel, ": north_star_workflow[").concat(index, "] must have a matching screen_sequence row with the same step id or route/CTA mapping."));
|
|
862
|
+
}
|
|
863
|
+
});
|
|
864
|
+
var firstScreenRoute = cleanField(firstScreen, ['route'], 240);
|
|
865
|
+
var hubScreens = screenSequence.filter(function (screen) {
|
|
866
|
+
var route = cleanField(screen, ['route'], 240);
|
|
867
|
+
return route === firstScreenRoute || /hub|dashboard/i.test(route);
|
|
868
|
+
});
|
|
869
|
+
var hubHasEmbeddedAction = hubScreens.some(function (screen) {
|
|
870
|
+
var text = [
|
|
871
|
+
cleanField(screen, ['embedded_action', 'hub_action', 'action'], 500),
|
|
872
|
+
cleanField(screen, ['method_or_calculation', 'server_method_or_publication', 'local_calculation_path', 'action_implementation'], 500),
|
|
873
|
+
cleanField(screen, ['expected_next_state', 'expected_state_transition'], 500)
|
|
874
|
+
].join(' ');
|
|
875
|
+
return text.trim().length >= 8 && !isNavigationOnlyAction(screen);
|
|
876
|
+
});
|
|
877
|
+
if (!hubHasEmbeddedAction) {
|
|
878
|
+
addJourneyIssue(issues, 'hub_missing_embedded_action', "".concat(pathLabel, ".journey_contract.screen_sequence"), "".concat(pathLabel, ": dashboard hub/first screen must embed at least one primary workflow action instead of acting as a link farm."));
|
|
879
|
+
}
|
|
880
|
+
var dataStory = contract.data_story;
|
|
881
|
+
if (!dataStory || typeof dataStory !== 'object' || Array.isArray(dataStory)) {
|
|
882
|
+
addJourneyIssue(issues, 'invalid_data_story', "".concat(pathLabel, ".journey_contract.data_story"), "".concat(pathLabel, ": data_story must be an object."));
|
|
883
|
+
}
|
|
884
|
+
else {
|
|
885
|
+
if (cleanField(dataStory, ['seeded_scenario', 'scenario'], 800).length < 12) {
|
|
886
|
+
addJourneyIssue(issues, 'missing_seeded_scenario', "".concat(pathLabel, ".journey_contract.data_story.seeded_scenario"), "".concat(pathLabel, ": data_story.seeded_scenario must describe the launch sample scenario."));
|
|
887
|
+
}
|
|
888
|
+
if (!asArray(readField(dataStory, ['records', 'seed_records'])).length) {
|
|
889
|
+
addJourneyIssue(issues, 'missing_seed_records', "".concat(pathLabel, ".journey_contract.data_story.records"), "".concat(pathLabel, ": data_story.records must list seeded records."));
|
|
890
|
+
}
|
|
891
|
+
if (!asArray(readField(dataStory, ['relationships', 'record_relationships'])).length) {
|
|
892
|
+
addJourneyIssue(issues, 'missing_seed_relationships', "".concat(pathLabel, ".journey_contract.data_story.relationships"), "".concat(pathLabel, ": data_story.relationships must list seeded data relationships."));
|
|
893
|
+
}
|
|
894
|
+
if (asArray(readField(dataStory, ['non_empty_states', 'non_empty_dashboard_states'])).length < 2) {
|
|
895
|
+
addJourneyIssue(issues, 'missing_non_empty_states', "".concat(pathLabel, ".journey_contract.data_story.non_empty_states"), "".concat(pathLabel, ": data_story.non_empty_states must list non-empty dashboard, workflow, or report states."));
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
if (asArray(contract.completion_states).length < 2) {
|
|
899
|
+
addJourneyIssue(issues, 'missing_completion_states', "".concat(pathLabel, ".journey_contract.completion_states"), "".concat(pathLabel, ": completion_states must define what done looks like to the user."));
|
|
900
|
+
}
|
|
901
|
+
var qaAssertions = asArray(contract.qa_assertions);
|
|
902
|
+
if (qaAssertions.length < 5) {
|
|
903
|
+
addJourneyIssue(issues, 'qa_assertions_too_short', "".concat(pathLabel, ".journey_contract.qa_assertions"), "".concat(pathLabel, ": qa_assertions must include login, hub action, workflow completion, sample data, and mobile proof."));
|
|
904
|
+
}
|
|
905
|
+
var workflowStepsWithQa = new Set();
|
|
906
|
+
var hasMobileQa = false;
|
|
907
|
+
var hasRecoveryQa = false;
|
|
908
|
+
var hasCompletionQa = false;
|
|
909
|
+
var hasNonEmptyQa = false;
|
|
910
|
+
var hasLoginQa = false;
|
|
911
|
+
var hasHubActionQa = false;
|
|
912
|
+
qaAssertions.forEach(function (assertion, index) {
|
|
913
|
+
var e_14, _a;
|
|
914
|
+
var qaPath = "".concat(pathLabel, ".journey_contract.qa_assertions[").concat(index, "]");
|
|
915
|
+
if (!assertion || typeof assertion !== 'object' || Array.isArray(assertion)) {
|
|
916
|
+
addJourneyIssue(issues, 'invalid_qa_assertion', qaPath, "".concat(pathLabel, ": qa_assertions[").concat(index, "] must be an object."));
|
|
917
|
+
return;
|
|
918
|
+
}
|
|
919
|
+
try {
|
|
920
|
+
for (var _b = __values([
|
|
921
|
+
['route', ['route', 'screen_route', 'path']],
|
|
922
|
+
['action', ['action', 'browser_steps', 'visible_cta']],
|
|
923
|
+
['expected_dom_or_data_proof', ['expected_dom_or_data_proof', 'proof', 'expected_result']]
|
|
924
|
+
]), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
925
|
+
var _d = __read(_c.value, 2), fieldName = _d[0], keys = _d[1];
|
|
926
|
+
if (cleanField(assertion, keys, 700).length < 3) {
|
|
927
|
+
addJourneyIssue(issues, 'incomplete_qa_assertion', "".concat(qaPath, ".").concat(fieldName), "".concat(pathLabel, ": qa_assertions[").concat(index, "].").concat(fieldName, " must be non-empty."));
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
catch (e_14_1) { e_14 = { error: e_14_1 }; }
|
|
932
|
+
finally {
|
|
933
|
+
try {
|
|
934
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
935
|
+
}
|
|
936
|
+
finally { if (e_14) throw e_14.error; }
|
|
937
|
+
}
|
|
938
|
+
var route = cleanField(assertion, ['route', 'screen_route', 'path'], 240);
|
|
939
|
+
if (route && !looksLikeAbsoluteRoute(route)) {
|
|
940
|
+
addJourneyIssue(issues, 'relative_qa_route', "".concat(qaPath, ".route"), "".concat(pathLabel, ": qa_assertions[").concat(index, "].route must be an absolute app route."));
|
|
941
|
+
}
|
|
942
|
+
var explicitCoverageTags = normalizeWorkflowQaCoverageTags(assertion, { includeProofKind: false });
|
|
943
|
+
var coverageTags = normalizeWorkflowQaCoverageTags(assertion);
|
|
944
|
+
if (!explicitCoverageTags.length) {
|
|
945
|
+
addJourneyIssue(issues, 'qa_assertion_missing_structured_coverage', "".concat(qaPath, ".coverage_tags"), "".concat(pathLabel, ": qa_assertions[").concat(index, "] must declare coverage_tags such as login, hub_action, workflow_completion, non_empty_data, mobile, or recovery; prose-only keyword detection is not accepted."));
|
|
946
|
+
}
|
|
947
|
+
hasLoginQa = hasLoginQa || coverageTags.includes('login');
|
|
948
|
+
hasHubActionQa = hasHubActionQa || coverageTags.includes('hub_action');
|
|
949
|
+
hasMobileQa = hasMobileQa || coverageTags.includes('mobile');
|
|
950
|
+
hasRecoveryQa = hasRecoveryQa || coverageTags.includes('recovery');
|
|
951
|
+
hasCompletionQa = hasCompletionQa || coverageTags.includes('workflow_completion');
|
|
952
|
+
hasNonEmptyQa = hasNonEmptyQa || coverageTags.includes('non_empty_data');
|
|
953
|
+
var mappedWorkflowStepIds = workflow
|
|
954
|
+
.map(function (step, workflowIndex) { return journeySourceMapsToWorkflowStep(assertion, step, workflowIndex) ? buildWorkflowStepId(step, workflowIndex) : ''; })
|
|
955
|
+
.filter(Boolean);
|
|
956
|
+
mappedWorkflowStepIds.forEach(function (stepId) { return workflowStepsWithQa.add(stepId); });
|
|
957
|
+
if (workflow.length && !mappedWorkflowStepIds.length) {
|
|
958
|
+
addJourneyIssue(issues, 'qa_assertion_unmapped_to_workflow', qaPath, "".concat(pathLabel, ": qa_assertions[").concat(index, "] must reference a north_star_workflow step by workflow_step_id/covers_workflow_step_ids or match that step's route and CTA/action."));
|
|
959
|
+
}
|
|
960
|
+
});
|
|
961
|
+
if (!hasLoginQa) {
|
|
962
|
+
addJourneyIssue(issues, 'missing_login_qa', "".concat(pathLabel, ".journey_contract.qa_assertions"), "".concat(pathLabel, ": qa_assertions missing structured login coverage."));
|
|
963
|
+
}
|
|
964
|
+
if (!hasHubActionQa) {
|
|
965
|
+
addJourneyIssue(issues, 'missing_hub_action_qa', "".concat(pathLabel, ".journey_contract.qa_assertions"), "".concat(pathLabel, ": qa_assertions missing structured dashboard hub action coverage."));
|
|
966
|
+
}
|
|
967
|
+
if (!hasCompletionQa) {
|
|
968
|
+
addJourneyIssue(issues, 'missing_completion_qa', "".concat(pathLabel, ".journey_contract.qa_assertions"), "".concat(pathLabel, ": qa_assertions missing business completion proof."));
|
|
969
|
+
}
|
|
970
|
+
if (!hasNonEmptyQa) {
|
|
971
|
+
addJourneyIssue(issues, 'missing_non_empty_qa', "".concat(pathLabel, ".journey_contract.qa_assertions"), "".concat(pathLabel, ": qa_assertions missing non-empty seeded data proof."));
|
|
972
|
+
}
|
|
973
|
+
if (!hasMobileQa) {
|
|
974
|
+
addJourneyIssue(issues, 'missing_mobile_qa', "".concat(pathLabel, ".journey_contract.qa_assertions"), "".concat(pathLabel, ": qa_assertions missing mobile viewport proof."));
|
|
975
|
+
}
|
|
976
|
+
if (!hasRecoveryQa) {
|
|
977
|
+
addJourneyIssue(issues, 'missing_recovery_qa', "".concat(pathLabel, ".journey_contract.qa_assertions"), "".concat(pathLabel, ": qa_assertions missing empty/error recovery proof."));
|
|
978
|
+
}
|
|
979
|
+
workflow.forEach(function (step, index) {
|
|
980
|
+
if (!step || typeof step !== 'object' || Array.isArray(step)) {
|
|
981
|
+
return;
|
|
982
|
+
}
|
|
983
|
+
var stepId = buildWorkflowStepId(step, index);
|
|
984
|
+
if (!workflowStepsWithQa.has(stepId)) {
|
|
985
|
+
addJourneyIssue(issues, 'workflow_step_missing_qa_assertion', "".concat(pathLabel, ".journey_contract.north_star_workflow[").concat(index, "]"), "".concat(pathLabel, ": north_star_workflow[").concat(index, "] must be covered by at least one qa_assertions row using workflow_step_id/covers_workflow_step_ids or matching route/CTA."));
|
|
986
|
+
}
|
|
987
|
+
});
|
|
988
|
+
var workflowQaRows = buildResolveIOAICoderWorkflowQaRowsFromJourneyContract(contract);
|
|
989
|
+
return {
|
|
990
|
+
valid: !issues.some(function (issue) { return issue.severity === 'error'; }),
|
|
991
|
+
contract: contract,
|
|
992
|
+
issues: issues,
|
|
993
|
+
workflowQaRows: workflowQaRows,
|
|
994
|
+
primaryWorkflowId: cleanField(contract, ['primary_workflow_id', 'workflow_id', 'id'], 160) || 'north-star'
|
|
995
|
+
};
|
|
996
|
+
}
|
|
997
|
+
function collectResolveIOAICoderJourneyContractIssues(input, options) {
|
|
998
|
+
if (options === void 0) { options = {}; }
|
|
999
|
+
return validateResolveIOAICoderJourneyContract(input, options).issues.map(function (issue) { return issue.message; });
|
|
1000
|
+
}
|
|
1001
|
+
function cleanNumber(value) {
|
|
1002
|
+
var parsed = Number(value);
|
|
1003
|
+
return Number.isFinite(parsed) && parsed > 0 ? Math.floor(parsed) : 0;
|
|
1004
|
+
}
|
|
1005
|
+
function cleanWorkflowQaRows(values, limit) {
|
|
1006
|
+
var e_15, _a;
|
|
1007
|
+
if (limit === void 0) { limit = 40; }
|
|
1008
|
+
if (!Array.isArray(values)) {
|
|
1009
|
+
return [];
|
|
1010
|
+
}
|
|
1011
|
+
var rows = [];
|
|
1012
|
+
try {
|
|
1013
|
+
for (var values_2 = __values(values), values_2_1 = values_2.next(); !values_2_1.done; values_2_1 = values_2.next()) {
|
|
1014
|
+
var value = values_2_1.value;
|
|
1015
|
+
if (!value || typeof value !== 'object') {
|
|
1016
|
+
continue;
|
|
1017
|
+
}
|
|
1018
|
+
var row = {
|
|
1019
|
+
index: cleanNumber(value.index) || undefined,
|
|
1020
|
+
workflowId: cleanText(value.workflowId || value.workflow_id, 160) || undefined,
|
|
1021
|
+
workflowStepId: cleanText(value.workflowStepId || value.workflow_step_id, 160) || undefined,
|
|
1022
|
+
workflowStepIds: cleanList(value.workflowStepIds || value.workflow_step_ids, 20, 160),
|
|
1023
|
+
stepId: cleanText(value.stepId || value.step_id, 160) || undefined,
|
|
1024
|
+
route: cleanText(value.route, 240) || undefined,
|
|
1025
|
+
action: cleanText(value.action, 500) || undefined,
|
|
1026
|
+
assertion: cleanText(value.assertion, 700) || undefined,
|
|
1027
|
+
expectedState: cleanText(value.expectedState || value.expected_state, 500) || undefined,
|
|
1028
|
+
expectedOutput: cleanText(value.expectedOutput || value.expected_output, 700) || undefined,
|
|
1029
|
+
proofKind: cleanText(value.proofKind || value.proof_kind, 120) || undefined,
|
|
1030
|
+
coverageTags: normalizeWorkflowQaCoverageTags(value),
|
|
1031
|
+
acceptanceGate: (value.acceptanceGate || value.acceptance_gate) === 'aiqa_business_assertion'
|
|
1032
|
+
? 'aiqa_business_assertion'
|
|
1033
|
+
: undefined,
|
|
1034
|
+
requiredArtifacts: cleanList(value.requiredArtifacts || value.required_artifacts, 20, 180),
|
|
1035
|
+
stateTransition: value.stateTransition || value.state_transition
|
|
1036
|
+
? {
|
|
1037
|
+
before: cleanText((value.stateTransition || value.state_transition).before, 700) || undefined,
|
|
1038
|
+
action: cleanText((value.stateTransition || value.state_transition).action, 700) || undefined,
|
|
1039
|
+
after: cleanText((value.stateTransition || value.state_transition).after, 700) || undefined,
|
|
1040
|
+
assertion: cleanText((value.stateTransition || value.state_transition).assertion, 700) || undefined
|
|
1041
|
+
}
|
|
1042
|
+
: undefined,
|
|
1043
|
+
status: cleanText(value.status, 120) || undefined,
|
|
1044
|
+
artifactPaths: cleanList(value.artifactPaths || value.artifact_paths, 20, 500)
|
|
1045
|
+
};
|
|
1046
|
+
if (row.workflowId || row.stepId || row.route || row.action || row.assertion) {
|
|
1047
|
+
rows.push(row);
|
|
1048
|
+
}
|
|
1049
|
+
if (rows.length >= limit) {
|
|
1050
|
+
break;
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
catch (e_15_1) { e_15 = { error: e_15_1 }; }
|
|
1055
|
+
finally {
|
|
1056
|
+
try {
|
|
1057
|
+
if (values_2_1 && !values_2_1.done && (_a = values_2.return)) _a.call(values_2);
|
|
1058
|
+
}
|
|
1059
|
+
finally { if (e_15) throw e_15.error; }
|
|
1060
|
+
}
|
|
1061
|
+
return rows;
|
|
1062
|
+
}
|
|
1063
|
+
function statusLooksPassed(value) {
|
|
1064
|
+
var normalized = cleanText(value, 120).toLowerCase();
|
|
1065
|
+
return !!normalized && /\b(pass|passed|success|succeeded|ok|done|complete|completed|ready|saved|published|deployed)\b/i.test(normalized);
|
|
1066
|
+
}
|
|
1067
|
+
function statusLooksFailed(value) {
|
|
1068
|
+
var normalized = cleanText(value, 160).toLowerCase();
|
|
1069
|
+
return !!normalized && /\b(fail|failed|error|blocked|missing|empty|stale|skipped|not ready|not_ready|cannot|could not|invalid)\b/i.test(normalized);
|
|
1070
|
+
}
|
|
1071
|
+
function normalizeProofKey(value) {
|
|
1072
|
+
return cleanText(value, 500).toLowerCase().replace(/[^a-z0-9]+/g, ' ').replace(/\s+/g, ' ').trim();
|
|
1073
|
+
}
|
|
1074
|
+
function cleanAssertionArtifactPaths(value) {
|
|
1075
|
+
return cleanList(value.artifactPaths
|
|
1076
|
+
|| value.artifact_paths
|
|
1077
|
+
|| value.artifacts
|
|
1078
|
+
|| value.screenshots
|
|
1079
|
+
|| (value.screenshot ? [value.screenshot] : []), 20, 500);
|
|
1080
|
+
}
|
|
1081
|
+
function normalizeWorkflowProofAssertion(value) {
|
|
1082
|
+
var source = value && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
1083
|
+
return {
|
|
1084
|
+
assertion: cleanText(source.assertion || source.name || source.label || source.expected, 1000),
|
|
1085
|
+
status: cleanText(source.status || source.outcome || source.result || (source.passed === true ? 'pass' : source.passed === false ? 'fail' : ''), 120),
|
|
1086
|
+
workflowId: cleanText(source.workflowId || source.workflow_id || source.workflow || source.workflowName || source.workflow_name, 200),
|
|
1087
|
+
stepId: cleanText(source.stepId || source.step_id || source.id || source.key, 200),
|
|
1088
|
+
route: cleanText(source.route || source.path || source.url, 500),
|
|
1089
|
+
action: cleanText(source.action || source.browser_steps || source.action_under_test || source.actionUnderTest, 800),
|
|
1090
|
+
expected: cleanText(source.expected || source.expected_state || source.expectedState || source.expected_business_state_change || source.expectedBusinessStateChange, 1000),
|
|
1091
|
+
observed: cleanText(source.observed || source.actual || source.after || source.after_state || source.afterState, 1000),
|
|
1092
|
+
dataProof: cleanText(source.dataProof || source.data_proof || source.domProof || source.dom_proof || source.proof || source.summary, 1400),
|
|
1093
|
+
artifactPaths: cleanAssertionArtifactPaths(source),
|
|
1094
|
+
metadata: source.metadata && typeof source.metadata === 'object' && !Array.isArray(source.metadata) ? source.metadata : {}
|
|
1095
|
+
};
|
|
1096
|
+
}
|
|
1097
|
+
function workflowRowKey(row, index) {
|
|
1098
|
+
return cleanText(row.stepId || row.assertion || row.action || row.route || "workflow-row-".concat(index + 1), 200);
|
|
1099
|
+
}
|
|
1100
|
+
function sameWorkflowRow(left, right) {
|
|
1101
|
+
var leftStep = normalizeProofKey(left.stepId);
|
|
1102
|
+
var rightStep = normalizeProofKey(right.stepId);
|
|
1103
|
+
if (leftStep && rightStep && leftStep === rightStep) {
|
|
1104
|
+
return true;
|
|
1105
|
+
}
|
|
1106
|
+
var leftRoute = normalizeProofKey(left.route);
|
|
1107
|
+
var rightRoute = normalizeProofKey(right.route);
|
|
1108
|
+
var leftAction = normalizeProofKey(left.action || left.assertion);
|
|
1109
|
+
var rightAction = normalizeProofKey(right.action || right.assertion);
|
|
1110
|
+
return !!leftRoute && !!rightRoute && leftRoute === rightRoute && !!leftAction && !!rightAction && (leftAction.includes(rightAction) || rightAction.includes(leftAction));
|
|
1111
|
+
}
|
|
1112
|
+
function mergeWorkflowQaRows(contractRows, recordedRows) {
|
|
1113
|
+
if (!contractRows.length) {
|
|
1114
|
+
return recordedRows;
|
|
1115
|
+
}
|
|
1116
|
+
return contractRows.map(function (contractRow) {
|
|
1117
|
+
var recorded = recordedRows.find(function (row) { return sameWorkflowRow(contractRow, row); });
|
|
1118
|
+
if (!recorded) {
|
|
1119
|
+
return contractRow;
|
|
1120
|
+
}
|
|
1121
|
+
return __assign(__assign(__assign({}, contractRow), recorded), { workflowId: recorded.workflowId || contractRow.workflowId, stepId: recorded.stepId || contractRow.stepId, route: recorded.route || contractRow.route, action: recorded.action || contractRow.action, assertion: recorded.assertion || contractRow.assertion, expectedState: recorded.expectedState || contractRow.expectedState, expectedOutput: recorded.expectedOutput || contractRow.expectedOutput, proofKind: recorded.proofKind || contractRow.proofKind, coverageTags: Array.from(new Set(__spreadArray(__spreadArray([], __read(cleanList(contractRow.coverageTags, 20, 120)), false), __read(cleanList(recorded.coverageTags, 20, 120)), false))), acceptanceGate: recorded.acceptanceGate || contractRow.acceptanceGate, requiredArtifacts: Array.from(new Set(__spreadArray(__spreadArray([], __read(cleanList(contractRow.requiredArtifacts, 20, 180)), false), __read(cleanList(recorded.requiredArtifacts, 20, 180)), false))), stateTransition: recorded.stateTransition || contractRow.stateTransition, artifactPaths: Array.from(new Set(__spreadArray(__spreadArray([], __read(cleanList(contractRow.artifactPaths, 20, 500)), false), __read(cleanList(recorded.artifactPaths, 20, 500)), false))) });
|
|
1122
|
+
});
|
|
1123
|
+
}
|
|
1124
|
+
function assertionMatchesWorkflowRow(assertion, row) {
|
|
1125
|
+
var metadata = assertion.metadata || {};
|
|
1126
|
+
if (metadata.workflowQaRowMatched === true || metadata.journeyContractMatched === true || metadata.aicoderWorkflowProof === true) {
|
|
1127
|
+
return true;
|
|
1128
|
+
}
|
|
1129
|
+
var rowStep = normalizeProofKey(row.stepId);
|
|
1130
|
+
var assertionStep = normalizeProofKey(assertion.stepId || metadata.stepId || metadata.step_id);
|
|
1131
|
+
if (rowStep && assertionStep && rowStep === assertionStep) {
|
|
1132
|
+
return true;
|
|
1133
|
+
}
|
|
1134
|
+
var rowRoute = normalizeProofKey(row.route);
|
|
1135
|
+
var assertionRoute = normalizeProofKey(assertion.route);
|
|
1136
|
+
var rowAction = normalizeProofKey(row.action || row.assertion);
|
|
1137
|
+
var assertionAction = normalizeProofKey([
|
|
1138
|
+
assertion.action,
|
|
1139
|
+
assertion.assertion,
|
|
1140
|
+
assertion.expected,
|
|
1141
|
+
assertion.observed,
|
|
1142
|
+
assertion.dataProof
|
|
1143
|
+
].filter(Boolean).join(' '));
|
|
1144
|
+
return !!rowRoute
|
|
1145
|
+
&& !!assertionRoute
|
|
1146
|
+
&& rowRoute === assertionRoute
|
|
1147
|
+
&& !!rowAction
|
|
1148
|
+
&& !!assertionAction
|
|
1149
|
+
&& (assertionAction.includes(rowAction) || rowAction.includes(assertionAction));
|
|
1150
|
+
}
|
|
1151
|
+
function workflowRowPassingAssertion(row, assertions) {
|
|
1152
|
+
return assertions.find(function (assertion) { return statusLooksPassed(assertion.status) && assertionMatchesWorkflowRow(assertion, row); });
|
|
1153
|
+
}
|
|
1154
|
+
function workflowAssertionHasObservedOutputProof(assertion) {
|
|
1155
|
+
if (!assertion) {
|
|
1156
|
+
return false;
|
|
1157
|
+
}
|
|
1158
|
+
return cleanText(assertion.dataProof, 1000).length >= 8
|
|
1159
|
+
|| cleanText(assertion.observed, 1000).length >= 8;
|
|
1160
|
+
}
|
|
1161
|
+
function workflowRowArtifactPaths(row, assertion) {
|
|
1162
|
+
return Array.from(new Set(__spreadArray(__spreadArray([], __read(cleanList(row.artifactPaths, 20, 500)), false), __read(cleanList(assertion === null || assertion === void 0 ? void 0 : assertion.artifactPaths, 20, 500)), false)));
|
|
1163
|
+
}
|
|
1164
|
+
function workflowRowRequiresOutputProof(row) {
|
|
1165
|
+
var _a, _b;
|
|
1166
|
+
var proofKind = cleanText(row.proofKind, 120).toLowerCase();
|
|
1167
|
+
if (/^(workflow_completion|report_export|non_empty_data|hub_action|business_workflow)$/.test(proofKind)) {
|
|
1168
|
+
return true;
|
|
1169
|
+
}
|
|
1170
|
+
var text = cleanText([
|
|
1171
|
+
row.expectedOutput,
|
|
1172
|
+
row.expectedState,
|
|
1173
|
+
row.assertion,
|
|
1174
|
+
(_a = row.stateTransition) === null || _a === void 0 ? void 0 : _a.after,
|
|
1175
|
+
(_b = row.stateTransition) === null || _b === void 0 ? void 0 : _b.assertion
|
|
1176
|
+
].filter(Boolean).join(' '), 1600).toLowerCase();
|
|
1177
|
+
return /\b(save|saved|persist|calculated|optimized|recommendation|report|export|result|non[-\s]?empty|record|row|kpi|table|chart)\b/.test(text);
|
|
1178
|
+
}
|
|
1179
|
+
function workflowRowRequiresMappedBusinessAssertion(row) {
|
|
1180
|
+
var _a;
|
|
1181
|
+
var proofKind = cleanText(row.proofKind, 120).toLowerCase();
|
|
1182
|
+
if (/^(workflow_completion|report_export)$/.test(proofKind)) {
|
|
1183
|
+
return true;
|
|
1184
|
+
}
|
|
1185
|
+
if (/^(mobile|recovery|hub_action|non_empty_data)$/.test(proofKind)) {
|
|
1186
|
+
return false;
|
|
1187
|
+
}
|
|
1188
|
+
var text = cleanText([
|
|
1189
|
+
row.stepId,
|
|
1190
|
+
row.expectedOutput,
|
|
1191
|
+
row.expectedState,
|
|
1192
|
+
row.assertion,
|
|
1193
|
+
(_a = row.stateTransition) === null || _a === void 0 ? void 0 : _a.after
|
|
1194
|
+
].filter(Boolean).join(' '), 1600).toLowerCase();
|
|
1195
|
+
return /\b(workflow[-_\s]?completion|save|saved|persist|calculated|optimized|recommendation|report|export|final result)\b/.test(text);
|
|
1196
|
+
}
|
|
1197
|
+
function workflowRowWeakProofReason(row, assertions) {
|
|
1198
|
+
var assertion = workflowRowPassingAssertion(row, assertions);
|
|
1199
|
+
var rowPassed = statusLooksPassed(row.status);
|
|
1200
|
+
if (!rowPassed && !assertion) {
|
|
1201
|
+
return '';
|
|
1202
|
+
}
|
|
1203
|
+
var artifactPaths = workflowRowArtifactPaths(row, assertion);
|
|
1204
|
+
var requiredArtifacts = cleanList(row.requiredArtifacts, 20, 180);
|
|
1205
|
+
if (requiredArtifacts.length && !artifactPaths.length) {
|
|
1206
|
+
return "".concat(workflowRowKey(row, 0), " missing required artifact proof: ").concat(requiredArtifacts.slice(0, 3).join(', '));
|
|
1207
|
+
}
|
|
1208
|
+
if (row.acceptanceGate === 'aiqa_business_assertion' && workflowRowRequiresMappedBusinessAssertion(row) && !assertion) {
|
|
1209
|
+
return "".concat(workflowRowKey(row, 0), " requires mapped AIQaBusinessAssertion proof.");
|
|
1210
|
+
}
|
|
1211
|
+
if (workflowRowRequiresOutputProof(row) && !workflowAssertionHasObservedOutputProof(assertion)) {
|
|
1212
|
+
return "".concat(workflowRowKey(row, 0), " missing observed DOM/data proof for the saved/calculated/report output.");
|
|
1213
|
+
}
|
|
1214
|
+
return '';
|
|
1215
|
+
}
|
|
1216
|
+
function workflowRowHasProof(row, assertions) {
|
|
1217
|
+
if (workflowRowWeakProofReason(row, assertions)) {
|
|
1218
|
+
return false;
|
|
1219
|
+
}
|
|
1220
|
+
if (statusLooksPassed(row.status) && cleanList(row.artifactPaths, 20, 500).length) {
|
|
1221
|
+
return true;
|
|
1222
|
+
}
|
|
1223
|
+
return !!workflowRowPassingAssertion(row, assertions);
|
|
1224
|
+
}
|
|
1225
|
+
function workflowRowFailed(row, assertions) {
|
|
1226
|
+
if (statusLooksFailed(row.status)) {
|
|
1227
|
+
return true;
|
|
1228
|
+
}
|
|
1229
|
+
return assertions.some(function (assertion) { return statusLooksFailed(assertion.status) && assertionMatchesWorkflowRow(assertion, row); });
|
|
1230
|
+
}
|
|
1231
|
+
function collectContractArtifactPaths(rows, assertions, extraPaths) {
|
|
1232
|
+
return Array.from(new Set(__spreadArray(__spreadArray(__spreadArray([], __read(cleanList(extraPaths, 40, 500)), false), __read(rows.flatMap(function (row) { return cleanList(row.artifactPaths, 20, 500); })), false), __read(assertions.flatMap(function (assertion) { return cleanList(assertion.artifactPaths, 20, 500); })), false))).slice(0, 80);
|
|
1233
|
+
}
|
|
1234
|
+
function stableProofValue(value) {
|
|
1235
|
+
if (Array.isArray(value)) {
|
|
1236
|
+
return value.map(stableProofValue);
|
|
1237
|
+
}
|
|
1238
|
+
if (value && typeof value === 'object') {
|
|
1239
|
+
return Object.keys(value)
|
|
1240
|
+
.sort()
|
|
1241
|
+
.reduce(function (accumulator, key) {
|
|
1242
|
+
var cleanKey = cleanText(key, 120);
|
|
1243
|
+
if (!cleanKey || /^(evaluatedAt|recordedAt|createdAt|updatedAt|timestamp|durationMs)$/i.test(cleanKey)) {
|
|
1244
|
+
return accumulator;
|
|
1245
|
+
}
|
|
1246
|
+
var nextValue = stableProofValue(value[key]);
|
|
1247
|
+
if (nextValue !== undefined && nextValue !== '' && !(Array.isArray(nextValue) && !nextValue.length)) {
|
|
1248
|
+
accumulator[cleanKey] = nextValue;
|
|
1249
|
+
}
|
|
1250
|
+
return accumulator;
|
|
1251
|
+
}, {});
|
|
1252
|
+
}
|
|
1253
|
+
if (typeof value === 'number') {
|
|
1254
|
+
return Number.isFinite(value) ? value : undefined;
|
|
1255
|
+
}
|
|
1256
|
+
if (typeof value === 'boolean') {
|
|
1257
|
+
return value;
|
|
1258
|
+
}
|
|
1259
|
+
return cleanText(value, 2000);
|
|
1260
|
+
}
|
|
1261
|
+
function fingerprintResolveIOAICoderWorkflowProofPayload(value, prefix) {
|
|
1262
|
+
var text = JSON.stringify(stableProofValue(value));
|
|
1263
|
+
var hash = 0;
|
|
1264
|
+
for (var index = 0; index < text.length; index += 1) {
|
|
1265
|
+
hash = ((hash << 5) - hash + text.charCodeAt(index)) | 0;
|
|
1266
|
+
}
|
|
1267
|
+
return "".concat(prefix, "-").concat(Math.abs(hash).toString(36));
|
|
1268
|
+
}
|
|
1269
|
+
function normalizeWorkflowProofFingerprintList() {
|
|
1270
|
+
var e_16, _a, e_17, _b;
|
|
1271
|
+
var values = [];
|
|
1272
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1273
|
+
values[_i] = arguments[_i];
|
|
1274
|
+
}
|
|
1275
|
+
var fingerprints = [];
|
|
1276
|
+
try {
|
|
1277
|
+
for (var values_3 = __values(values), values_3_1 = values_3.next(); !values_3_1.done; values_3_1 = values_3.next()) {
|
|
1278
|
+
var value = values_3_1.value;
|
|
1279
|
+
var list = Array.isArray(value) ? value : value ? [value] : [];
|
|
1280
|
+
try {
|
|
1281
|
+
for (var list_1 = (e_17 = void 0, __values(list)), list_1_1 = list_1.next(); !list_1_1.done; list_1_1 = list_1.next()) {
|
|
1282
|
+
var entry = list_1_1.value;
|
|
1283
|
+
var normalized = cleanText(entry, 200);
|
|
1284
|
+
if (normalized && !fingerprints.includes(normalized)) {
|
|
1285
|
+
fingerprints.push(normalized);
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
catch (e_17_1) { e_17 = { error: e_17_1 }; }
|
|
1290
|
+
finally {
|
|
1291
|
+
try {
|
|
1292
|
+
if (list_1_1 && !list_1_1.done && (_b = list_1.return)) _b.call(list_1);
|
|
1293
|
+
}
|
|
1294
|
+
finally { if (e_17) throw e_17.error; }
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
catch (e_16_1) { e_16 = { error: e_16_1 }; }
|
|
1299
|
+
finally {
|
|
1300
|
+
try {
|
|
1301
|
+
if (values_3_1 && !values_3_1.done && (_a = values_3.return)) _a.call(values_3);
|
|
1302
|
+
}
|
|
1303
|
+
finally { if (e_16) throw e_16.error; }
|
|
1304
|
+
}
|
|
1305
|
+
return fingerprints.slice(0, 40);
|
|
1306
|
+
}
|
|
1307
|
+
function evaluateResolveIOAICoderWorkflowProofReadiness(input) {
|
|
1308
|
+
var _a, _b;
|
|
1309
|
+
if (input === void 0) { input = {}; }
|
|
1310
|
+
var now = isoNow(input.now);
|
|
1311
|
+
var journeyInput = input.journeyContract !== undefined ? input.journeyContract : input.journeyContractMarkdown;
|
|
1312
|
+
var hasJourneyInput = journeyInput !== undefined && journeyInput !== null && cleanText(journeyInput, 100).length > 0;
|
|
1313
|
+
var journeyValidation = hasJourneyInput
|
|
1314
|
+
? validateResolveIOAICoderJourneyContract(journeyInput, {
|
|
1315
|
+
requireMarkdownEnvelope: typeof journeyInput === 'string'
|
|
1316
|
+
})
|
|
1317
|
+
: {
|
|
1318
|
+
valid: false,
|
|
1319
|
+
contract: null,
|
|
1320
|
+
issues: [{
|
|
1321
|
+
code: 'missing_contract',
|
|
1322
|
+
path: 'docs/APP_JOURNEY_CONTRACT.md',
|
|
1323
|
+
message: 'docs/APP_JOURNEY_CONTRACT.md is required before workflow proof can accept the app.',
|
|
1324
|
+
severity: 'error'
|
|
1325
|
+
}],
|
|
1326
|
+
workflowQaRows: [],
|
|
1327
|
+
primaryWorkflowId: ''
|
|
1328
|
+
};
|
|
1329
|
+
var recordedRows = cleanWorkflowQaRows(input.workflowQaRows, 120);
|
|
1330
|
+
var rows = mergeWorkflowQaRows(journeyValidation.workflowQaRows, recordedRows);
|
|
1331
|
+
var assertions = asArray(input.businessAssertions).map(normalizeWorkflowProofAssertion).filter(function (assertion) {
|
|
1332
|
+
return assertion.assertion || assertion.route || assertion.action || assertion.dataProof || assertion.status;
|
|
1333
|
+
});
|
|
1334
|
+
var routeOnly = asArray(input.routeProbes).some(function (probe) { return statusLooksPassed((probe === null || probe === void 0 ? void 0 : probe.status) || ((probe === null || probe === void 0 ? void 0 : probe.passed) === true ? 'pass' : '')); })
|
|
1335
|
+
&& !assertions.some(function (assertion) { return statusLooksPassed(assertion.status); });
|
|
1336
|
+
var weakProofReasons = rows.map(function (row) { return workflowRowWeakProofReason(row, assertions); }).filter(Boolean);
|
|
1337
|
+
var failedRows = rows.filter(function (row) { return workflowRowFailed(row, assertions); });
|
|
1338
|
+
var passedRows = rows.filter(function (row) { return workflowRowHasProof(row, assertions); });
|
|
1339
|
+
var missingRows = rows.filter(function (row) { return !workflowRowHasProof(row, assertions) && !workflowRowFailed(row, assertions); });
|
|
1340
|
+
var passedAssertions = assertions.filter(function (assertion) { return statusLooksPassed(assertion.status); });
|
|
1341
|
+
var releaseBlockers = [
|
|
1342
|
+
statusLooksFailed(input.deployStatus) ? "deploy=".concat(cleanText(input.deployStatus, 160)) : '',
|
|
1343
|
+
statusLooksFailed(input.publishStatus) ? "publish=".concat(cleanText(input.publishStatus, 160)) : '',
|
|
1344
|
+
statusLooksFailed(input.sampleDataStatus) ? "sample_data=".concat(cleanText(input.sampleDataStatus, 160)) : ''
|
|
1345
|
+
].filter(Boolean);
|
|
1346
|
+
var hasDataProof = passedAssertions.some(function (assertion) { return cleanText(assertion.dataProof, 1000).length >= 8; });
|
|
1347
|
+
var sampleDataReady = statusLooksPassed(input.sampleDataStatus)
|
|
1348
|
+
|| (!statusLooksFailed(input.sampleDataStatus) && hasDataProof);
|
|
1349
|
+
var artifactPaths = collectContractArtifactPaths(rows, assertions, input.artifactPaths);
|
|
1350
|
+
var workflowProofFingerprint = fingerprintResolveIOAICoderWorkflowProofPayload({
|
|
1351
|
+
primaryWorkflowId: journeyValidation.primaryWorkflowId || cleanText((_a = recordedRows[0]) === null || _a === void 0 ? void 0 : _a.workflowId, 160),
|
|
1352
|
+
passedWorkflowRows: passedRows.map(workflowRowKey),
|
|
1353
|
+
failedWorkflowRows: failedRows.map(workflowRowKey),
|
|
1354
|
+
missingWorkflowRows: missingRows.map(workflowRowKey),
|
|
1355
|
+
passedBusinessAssertions: passedAssertions.map(function (assertion) { return ({
|
|
1356
|
+
assertion: assertion.assertion,
|
|
1357
|
+
workflowId: assertion.workflowId,
|
|
1358
|
+
stepId: assertion.stepId,
|
|
1359
|
+
route: assertion.route,
|
|
1360
|
+
action: assertion.action,
|
|
1361
|
+
expected: assertion.expected,
|
|
1362
|
+
observed: assertion.observed,
|
|
1363
|
+
dataProof: assertion.dataProof,
|
|
1364
|
+
artifactPaths: assertion.artifactPaths
|
|
1365
|
+
}); }),
|
|
1366
|
+
sampleDataStatus: input.sampleDataStatus,
|
|
1367
|
+
sampleDataReady: sampleDataReady,
|
|
1368
|
+
artifactPaths: artifactPaths
|
|
1369
|
+
}, 'aicoder-workflow-proof');
|
|
1370
|
+
var artifactFingerprint = fingerprintResolveIOAICoderWorkflowProofPayload({
|
|
1371
|
+
artifactPaths: artifactPaths,
|
|
1372
|
+
businessDataProof: passedAssertions.map(function (assertion) { return ({
|
|
1373
|
+
stepId: assertion.stepId,
|
|
1374
|
+
route: assertion.route,
|
|
1375
|
+
dataProof: assertion.dataProof,
|
|
1376
|
+
observed: assertion.observed,
|
|
1377
|
+
artifactPaths: assertion.artifactPaths
|
|
1378
|
+
}); })
|
|
1379
|
+
}, 'aicoder-workflow-artifacts');
|
|
1380
|
+
var previousWorkflowFingerprints = normalizeWorkflowProofFingerprintList(input.previousWorkflowProofFingerprint, input.previousWorkflowProofFingerprints);
|
|
1381
|
+
var previousArtifactFingerprints = normalizeWorkflowProofFingerprintList(input.previousArtifactFingerprint, input.previousArtifactFingerprints);
|
|
1382
|
+
var proofFreshness = 'unknown';
|
|
1383
|
+
if (!passedAssertions.length && !artifactPaths.length) {
|
|
1384
|
+
proofFreshness = 'missing';
|
|
1385
|
+
}
|
|
1386
|
+
else if (previousWorkflowFingerprints.includes(workflowProofFingerprint)) {
|
|
1387
|
+
proofFreshness = 'same_as_previous';
|
|
1388
|
+
}
|
|
1389
|
+
else if (previousArtifactFingerprints.includes(artifactFingerprint)) {
|
|
1390
|
+
proofFreshness = 'stale_artifact';
|
|
1391
|
+
}
|
|
1392
|
+
else {
|
|
1393
|
+
proofFreshness = 'fresh';
|
|
1394
|
+
}
|
|
1395
|
+
var blockers = [];
|
|
1396
|
+
var status = 'ready';
|
|
1397
|
+
var reason = 'Journey contract and workflow business proof are ready.';
|
|
1398
|
+
var nextAction = 'Proceed to the smallest remaining release gate.';
|
|
1399
|
+
if (!hasJourneyInput) {
|
|
1400
|
+
status = 'missing_journey_contract';
|
|
1401
|
+
blockers.push('Generate and validate docs/APP_JOURNEY_CONTRACT.md before build/acceptance.');
|
|
1402
|
+
reason = 'AICoder cannot accept an app without a journey contract.';
|
|
1403
|
+
nextAction = 'Run journey_contract generation and validation first.';
|
|
1404
|
+
}
|
|
1405
|
+
else if (!journeyValidation.valid) {
|
|
1406
|
+
status = 'journey_invalid';
|
|
1407
|
+
blockers.push.apply(blockers, __spreadArray([], __read(journeyValidation.issues.filter(function (issue) { return issue.severity === 'error'; }).map(function (issue) { return issue.message; }).slice(0, 8)), false));
|
|
1408
|
+
reason = 'Journey contract validation failed.';
|
|
1409
|
+
nextAction = 'Repair docs/APP_JOURNEY_CONTRACT.md before product-code repair.';
|
|
1410
|
+
}
|
|
1411
|
+
else if (routeOnly) {
|
|
1412
|
+
status = 'route_only';
|
|
1413
|
+
blockers.push('Route/browser proof passed, but no workflow business assertion passed.');
|
|
1414
|
+
reason = 'Route-only proof cannot accept an AICoder app.';
|
|
1415
|
+
nextAction = 'Run workflow QA generated from the journey contract.';
|
|
1416
|
+
}
|
|
1417
|
+
else if (!rows.length) {
|
|
1418
|
+
status = 'workflow_qa_missing';
|
|
1419
|
+
blockers.push('No workflow QA rows were generated or recorded from the journey contract.');
|
|
1420
|
+
reason = 'Workflow QA evidence is missing.';
|
|
1421
|
+
nextAction = 'Generate workflow QA rows from journey_contract.qa_assertions.';
|
|
1422
|
+
}
|
|
1423
|
+
else if (weakProofReasons.length) {
|
|
1424
|
+
status = 'business_proof_weak';
|
|
1425
|
+
blockers.push.apply(blockers, __spreadArray([], __read(weakProofReasons.slice(0, 8)), false));
|
|
1426
|
+
reason = 'Workflow QA rows passed without the structured artifacts or mapped output proof required by the Journey Contract.';
|
|
1427
|
+
nextAction = 'Rerun the weak workflow QA rows and record AIQaBusinessAssertion plus required artifacts.';
|
|
1428
|
+
}
|
|
1429
|
+
else if (failedRows.length || missingRows.length) {
|
|
1430
|
+
status = 'workflow_qa_incomplete';
|
|
1431
|
+
blockers.push.apply(blockers, __spreadArray(__spreadArray([], __read(failedRows.map(function (row, index) { return "failed:".concat(workflowRowKey(row, index)); }).slice(0, 8)), false), __read(missingRows.map(function (row, index) { return "missing:".concat(workflowRowKey(row, index)); }).slice(0, 8)), false));
|
|
1432
|
+
reason = 'Not all journey contract workflow QA rows have passed business proof.';
|
|
1433
|
+
nextAction = 'Rerun or repair the incomplete workflow QA rows before publish.';
|
|
1434
|
+
}
|
|
1435
|
+
else if (!passedAssertions.length) {
|
|
1436
|
+
status = input.scorecardPassed === true ? 'business_proof_missing' : 'workflow_qa_incomplete';
|
|
1437
|
+
blockers.push('Workflow rows have no mapped AIQaBusinessAssertion business proof.');
|
|
1438
|
+
reason = input.scorecardPassed === true
|
|
1439
|
+
? 'Scorecard-only proof is not acceptance.'
|
|
1440
|
+
: 'Workflow business proof is missing.';
|
|
1441
|
+
nextAction = 'Record AIQaBusinessAssertion rows tied to the journey contract.';
|
|
1442
|
+
}
|
|
1443
|
+
else if (releaseBlockers.length) {
|
|
1444
|
+
status = 'release_blocked';
|
|
1445
|
+
blockers.push.apply(blockers, __spreadArray([], __read(releaseBlockers), false));
|
|
1446
|
+
reason = 'Workflow proof passed, but release/deploy/sample-data gates block acceptance.';
|
|
1447
|
+
nextAction = 'Repair only the failed release gate or hotfix artifact before rerunning publish/deploy.';
|
|
1448
|
+
}
|
|
1449
|
+
else if (!sampleDataReady) {
|
|
1450
|
+
status = 'sample_data_missing';
|
|
1451
|
+
blockers.push('No non-empty seeded/sample data proof is available for the workflow.');
|
|
1452
|
+
reason = 'AICoder app proof must include meaningful non-empty data.';
|
|
1453
|
+
nextAction = 'Seed meaningful records and rerun workflow QA against that data.';
|
|
1454
|
+
}
|
|
1455
|
+
else if (proofFreshness === 'same_as_previous' || proofFreshness === 'stale_artifact') {
|
|
1456
|
+
status = 'stale_workflow_proof';
|
|
1457
|
+
blockers.push(proofFreshness === 'same_as_previous'
|
|
1458
|
+
? 'Workflow business proof fingerprint is unchanged from a prior run.'
|
|
1459
|
+
: 'Workflow proof artifacts are unchanged from a prior run.');
|
|
1460
|
+
reason = 'AICoder workflow proof is stale; repeated evidence cannot advance acceptance.';
|
|
1461
|
+
nextAction = 'Rerun workflow QA from journey_contract.qa_assertions and record fresh AIQaBusinessAssertion artifacts.';
|
|
1462
|
+
}
|
|
1463
|
+
return {
|
|
1464
|
+
ready: status === 'ready',
|
|
1465
|
+
status: status,
|
|
1466
|
+
reason: reason,
|
|
1467
|
+
blockers: blockers,
|
|
1468
|
+
journeyContractValid: journeyValidation.valid,
|
|
1469
|
+
primaryWorkflowId: journeyValidation.primaryWorkflowId || cleanText((_b = recordedRows[0]) === null || _b === void 0 ? void 0 : _b.workflowId, 160),
|
|
1470
|
+
passedWorkflowRows: passedRows.map(workflowRowKey),
|
|
1471
|
+
missingWorkflowRows: missingRows.map(workflowRowKey),
|
|
1472
|
+
failedWorkflowRows: failedRows.map(workflowRowKey),
|
|
1473
|
+
passedBusinessAssertions: passedAssertions.map(function (assertion) { return cleanText(assertion.assertion || assertion.stepId || assertion.route, 300); }).filter(Boolean).slice(0, 40),
|
|
1474
|
+
routeOnly: routeOnly,
|
|
1475
|
+
scorecardOnly: input.scorecardPassed === true && !passedAssertions.length,
|
|
1476
|
+
sampleDataReady: sampleDataReady,
|
|
1477
|
+
releaseBlockers: releaseBlockers,
|
|
1478
|
+
artifactPaths: artifactPaths,
|
|
1479
|
+
workflowProofFingerprint: workflowProofFingerprint,
|
|
1480
|
+
artifactFingerprint: artifactFingerprint,
|
|
1481
|
+
proofFreshness: proofFreshness,
|
|
1482
|
+
nextAction: nextAction,
|
|
1483
|
+
evaluatedAt: now
|
|
1484
|
+
};
|
|
1485
|
+
}
|
|
1486
|
+
function fingerprintResolveIOAICoderV6Blocker(value) {
|
|
1487
|
+
var text = cleanText(value, 4000)
|
|
1488
|
+
.toLowerCase()
|
|
1489
|
+
.replace(/[a-f0-9]{16,}/g, '<id>')
|
|
1490
|
+
.replace(/\b\d{2,}\b/g, '<n>')
|
|
1491
|
+
.replace(/\bline\s+<n>\b/g, 'line <n>')
|
|
1492
|
+
.replace(/https?:\/\/\S+/g, '<url>');
|
|
1493
|
+
var hash = 0;
|
|
1494
|
+
for (var index = 0; index < text.length; index += 1) {
|
|
1495
|
+
hash = ((hash << 5) - hash + text.charCodeAt(index)) | 0;
|
|
1496
|
+
}
|
|
1497
|
+
return "aicoder-v6-".concat(Math.abs(hash).toString(36));
|
|
1498
|
+
}
|
|
1499
|
+
function classifyResolveIOAICoderV6FailureClass(step) {
|
|
1500
|
+
var explicit = cleanText(step.failureClass, 80).toLowerCase().replace(/[\s-]+/g, '_');
|
|
1501
|
+
if (explicit) {
|
|
1502
|
+
return explicit;
|
|
1503
|
+
}
|
|
1504
|
+
if (step.outcome === 'infra_retry') {
|
|
1505
|
+
return 'infra';
|
|
1506
|
+
}
|
|
1507
|
+
var text = "".concat(step.stepType || '', "\n").concat(step.lane || '', "\n").concat(step.blocker || '', "\n").concat(step.summary || '').toLowerCase();
|
|
1508
|
+
if (/\b(puppeteer|chrome|browser executable|mongo|port|startup|settings\.json|node_modules|npm install|cache|lock)\b/.test(text)) {
|
|
1509
|
+
return 'infra';
|
|
1510
|
+
}
|
|
1511
|
+
if (/\b(ts[0-9]{3,5}|typescript|compile|build failed|ng build|cannot find name|module not found|syntax error)\b/.test(text)
|
|
1512
|
+
|| step.stepType === 'build') {
|
|
1513
|
+
return 'compile';
|
|
1514
|
+
}
|
|
1515
|
+
if (step.stepType === 'journey_contract' || step.stepType === 'journey_validation') {
|
|
1516
|
+
return 'journey';
|
|
1517
|
+
}
|
|
1518
|
+
if (step.stepType === 'workflow_qa' || step.lane === 'qa') {
|
|
1519
|
+
return 'business';
|
|
1520
|
+
}
|
|
1521
|
+
if (step.stepType === 'publish' || step.stepType === 'test_deploy' || step.stepType === 'live_deploy' || step.lane === 'publish') {
|
|
1522
|
+
return 'release';
|
|
1523
|
+
}
|
|
1524
|
+
return 'product_code';
|
|
1525
|
+
}
|
|
1526
|
+
function aicoderWorkflowReadinessNextCommand(status) {
|
|
1527
|
+
switch (status) {
|
|
1528
|
+
case 'journey_contract_required':
|
|
1529
|
+
return 'Generate and validate docs/APP_JOURNEY_CONTRACT.md before product-code build work.';
|
|
1530
|
+
case 'journey_contract_repair_required':
|
|
1531
|
+
return 'Repair the journey contract until first/next/last workflow QA rows validate.';
|
|
1532
|
+
case 'workflow_build_ready':
|
|
1533
|
+
return 'Build the north-star workflow from the journey contract and seeded data story.';
|
|
1534
|
+
case 'workflow_qa_required':
|
|
1535
|
+
return 'Run workflow QA from journey_contract.qa_assertions and record AIQaBusinessAssertion proof.';
|
|
1536
|
+
case 'workflow_business_proof_ready':
|
|
1537
|
+
return 'Proceed only to release/publish gates; wow UI polish is allowed after business proof.';
|
|
1538
|
+
case 'release_repair_required':
|
|
1539
|
+
return 'Repair the failed publish/deploy/sample-data gate without rebuilding the app shell.';
|
|
1540
|
+
case 'infra_repair_only':
|
|
1541
|
+
return 'Repair Puppeteer, Chrome, Mongo, startup, port, cache, or environment evidence only.';
|
|
1542
|
+
case 'compile_repair_only':
|
|
1543
|
+
return 'Repair compile/build evidence only and rerun the same deterministic build gate.';
|
|
1544
|
+
case 'collect_new_evidence':
|
|
1545
|
+
return 'Collect new evidence for the stuck blocker before another model/code loop.';
|
|
1546
|
+
case 'budget_stopped':
|
|
1547
|
+
return 'Stop autonomous spend and request a bounded human decision.';
|
|
1548
|
+
case 'parked':
|
|
1549
|
+
return 'Park the run until a human chooses the next bounded action.';
|
|
1550
|
+
default:
|
|
1551
|
+
return 'Review workflow evidence before continuing.';
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
function aicoderWorkflowReadinessGateFor(status) {
|
|
1555
|
+
switch (status) {
|
|
1556
|
+
case 'journey_contract_required':
|
|
1557
|
+
case 'journey_contract_repair_required':
|
|
1558
|
+
return 'journey_contract';
|
|
1559
|
+
case 'workflow_build_ready':
|
|
1560
|
+
return 'build';
|
|
1561
|
+
case 'workflow_qa_required':
|
|
1562
|
+
case 'workflow_business_proof_ready':
|
|
1563
|
+
return 'workflow_qa';
|
|
1564
|
+
case 'release_repair_required':
|
|
1565
|
+
return 'release';
|
|
1566
|
+
case 'infra_repair_only':
|
|
1567
|
+
return 'infra';
|
|
1568
|
+
case 'compile_repair_only':
|
|
1569
|
+
return 'compile';
|
|
1570
|
+
case 'collect_new_evidence':
|
|
1571
|
+
return 'evidence';
|
|
1572
|
+
case 'budget_stopped':
|
|
1573
|
+
case 'parked':
|
|
1574
|
+
return 'manual';
|
|
1575
|
+
default:
|
|
1576
|
+
return 'manual';
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
function buildResolveIOAICoderWorkflowProofCheckpoint(input) {
|
|
1580
|
+
var _a, _b, _c, _d, _e;
|
|
1581
|
+
var status = input.status;
|
|
1582
|
+
var nextGate = input.nextGate;
|
|
1583
|
+
var proofArtifacts = cleanList(input.businessProofArtifacts, 80, 500);
|
|
1584
|
+
var workflowRows = cleanWorkflowQaRows(input.workflowQaRows, 80);
|
|
1585
|
+
var completedWorkflowSteps = cleanList(input.completedWorkflowSteps, 80, 240);
|
|
1586
|
+
var workflowProofFingerprint = fingerprintResolveIOAICoderWorkflowProofPayload({
|
|
1587
|
+
primaryWorkflowId: input.primaryWorkflowId,
|
|
1588
|
+
activeWorkflowStep: input.activeWorkflowStep,
|
|
1589
|
+
workflowRows: workflowRows.map(function (row) { return ({
|
|
1590
|
+
workflowId: row.workflowId,
|
|
1591
|
+
stepId: row.stepId,
|
|
1592
|
+
status: row.status,
|
|
1593
|
+
acceptanceGate: row.acceptanceGate,
|
|
1594
|
+
assertion: row.assertion
|
|
1595
|
+
}); }),
|
|
1596
|
+
completedWorkflowSteps: completedWorkflowSteps,
|
|
1597
|
+
proofArtifacts: proofArtifacts
|
|
1598
|
+
}, 'aicoder-workflow-readiness');
|
|
1599
|
+
var artifactFingerprint = fingerprintResolveIOAICoderWorkflowProofPayload({
|
|
1600
|
+
proofArtifacts: proofArtifacts,
|
|
1601
|
+
rowArtifacts: workflowRows.flatMap(function (row) { return cleanList(row.artifactPaths, 10, 500); })
|
|
1602
|
+
}, 'aicoder-workflow-artifacts');
|
|
1603
|
+
var requiredEvidenceByStatus = {
|
|
1604
|
+
journey_contract_required: [
|
|
1605
|
+
'docs/APP_JOURNEY_CONTRACT.md with validated journey_contract JSON',
|
|
1606
|
+
'first/next/last north_star_workflow steps',
|
|
1607
|
+
'workflow QA rows generated from journey_contract.qa_assertions'
|
|
1608
|
+
],
|
|
1609
|
+
journey_contract_repair_required: [
|
|
1610
|
+
'repaired journey contract validation result',
|
|
1611
|
+
'command-center hub action mapped to workflow state transition'
|
|
1612
|
+
],
|
|
1613
|
+
workflow_build_ready: [
|
|
1614
|
+
'implemented north-star workflow from the Journey Contract',
|
|
1615
|
+
'seeded data story available in the app'
|
|
1616
|
+
],
|
|
1617
|
+
workflow_qa_required: [
|
|
1618
|
+
'AIQaBusinessAssertion for the north-star workflow',
|
|
1619
|
+
'non-empty data proof',
|
|
1620
|
+
'saved/calculated output proof',
|
|
1621
|
+
'report/export proof when promised'
|
|
1622
|
+
],
|
|
1623
|
+
workflow_business_proof_ready: [
|
|
1624
|
+
'deterministic release gate before publish',
|
|
1625
|
+
'workflow proof artifact retained for acceptance'
|
|
1626
|
+
],
|
|
1627
|
+
release_repair_required: [
|
|
1628
|
+
'publish/deploy/sample-data failure artifact',
|
|
1629
|
+
'hotfix or release-gate evidence before another full deploy'
|
|
1630
|
+
],
|
|
1631
|
+
infra_repair_only: [
|
|
1632
|
+
'Puppeteer/Chrome/Mongo/startup/preflight evidence',
|
|
1633
|
+
'infra failure class changed or preflight passed'
|
|
1634
|
+
],
|
|
1635
|
+
compile_repair_only: [
|
|
1636
|
+
'compile/build log evidence',
|
|
1637
|
+
'compile failure class changed or build passed'
|
|
1638
|
+
],
|
|
1639
|
+
collect_new_evidence: [
|
|
1640
|
+
'changed blocker fingerprint or evidence hash',
|
|
1641
|
+
'fresh workflow QA artifact',
|
|
1642
|
+
'AIQaBusinessAssertion or precise workflow blocker artifact'
|
|
1643
|
+
],
|
|
1644
|
+
budget_stopped: [
|
|
1645
|
+
'budget summary',
|
|
1646
|
+
'one human decision for next bounded action'
|
|
1647
|
+
],
|
|
1648
|
+
parked: [
|
|
1649
|
+
'operator decision',
|
|
1650
|
+
'new evidence before retry'
|
|
1651
|
+
]
|
|
1652
|
+
};
|
|
1653
|
+
var waitingStatus = status === 'workflow_business_proof_ready'
|
|
1654
|
+
? 'ready_to_continue'
|
|
1655
|
+
: status === 'release_repair_required'
|
|
1656
|
+
? 'waiting_for_release_gate'
|
|
1657
|
+
: status === 'collect_new_evidence' || input.sameFailureParked === true
|
|
1658
|
+
? 'waiting_for_new_evidence'
|
|
1659
|
+
: status === 'infra_repair_only' || status === 'compile_repair_only'
|
|
1660
|
+
? 'waiting_for_infra_or_compile'
|
|
1661
|
+
: status === 'journey_contract_required' || status === 'journey_contract_repair_required'
|
|
1662
|
+
? 'waiting_for_journey_contract'
|
|
1663
|
+
: 'waiting_for_workflow_proof';
|
|
1664
|
+
var blocksProductRepairUntilJourneyContract = input.journeyContractReady !== true
|
|
1665
|
+
|| status === 'journey_contract_required'
|
|
1666
|
+
|| status === 'journey_contract_repair_required';
|
|
1667
|
+
var blocksPublishUntilWorkflowProof = input.businessProofReady !== true
|
|
1668
|
+
|| input.routeOnlyBlocked === true
|
|
1669
|
+
|| input.sameFailureParked === true
|
|
1670
|
+
|| blocksProductRepairUntilJourneyContract
|
|
1671
|
+
|| status === 'workflow_qa_required'
|
|
1672
|
+
|| status === 'workflow_build_ready'
|
|
1673
|
+
|| status === 'collect_new_evidence';
|
|
1674
|
+
return {
|
|
1675
|
+
required: true,
|
|
1676
|
+
status: waitingStatus,
|
|
1677
|
+
readinessStatus: status,
|
|
1678
|
+
nextGate: nextGate,
|
|
1679
|
+
startingFailureClass: cleanText((_a = input.last) === null || _a === void 0 ? void 0 : _a.failureClass, 120),
|
|
1680
|
+
startingBlockerFingerprint: cleanText(((_b = input.last) === null || _b === void 0 ? void 0 : _b.blockerFingerprint) || fingerprintResolveIOAICoderV6Blocker(((_c = input.last) === null || _c === void 0 ? void 0 : _c.blocker) || ((_d = input.last) === null || _d === void 0 ? void 0 : _d.summary) || ''), 160),
|
|
1681
|
+
startingEvidenceHash: cleanText((_e = input.last) === null || _e === void 0 ? void 0 : _e.evidenceHash, 160),
|
|
1682
|
+
workflowProofFingerprint: workflowProofFingerprint,
|
|
1683
|
+
artifactFingerprint: artifactFingerprint,
|
|
1684
|
+
requiredEvidence: (requiredEvidenceByStatus[status] || []).slice(0, 20),
|
|
1685
|
+
requiredResetEvidence: Array.from(new Set(__spreadArray(__spreadArray(__spreadArray([], __read((requiredEvidenceByStatus[status] || [])), false), __read((input.sameFailureParked === true ? ['new workflow proof fingerprint', 'new artifact fingerprint'] : [])), false), __read((input.releaseBlocked === true ? ['changed release gate fingerprint'] : [])), false))).slice(0, 20),
|
|
1686
|
+
successRequiresWorkflowBusinessProof: status !== 'infra_repair_only' && status !== 'compile_repair_only' && status !== 'budget_stopped',
|
|
1687
|
+
blocksProductRepairUntilJourneyContract: blocksProductRepairUntilJourneyContract,
|
|
1688
|
+
blocksPublishUntilWorkflowProof: blocksPublishUntilWorkflowProof,
|
|
1689
|
+
blocksPublishUntilReleaseGate: input.releaseBlocked === true || status === 'release_repair_required',
|
|
1690
|
+
blocksWowUiUntilWorkflowProof: blocksPublishUntilWorkflowProof,
|
|
1691
|
+
nextAction: cleanText(input.nextAction, 500) || aicoderWorkflowReadinessNextCommand(status)
|
|
1692
|
+
};
|
|
1693
|
+
}
|
|
1694
|
+
function buildResolveIOAICoderV6WorkflowReadiness(bundle, context) {
|
|
1695
|
+
var _a, _b;
|
|
1696
|
+
if (context === void 0) { context = {}; }
|
|
1697
|
+
var history = Array.isArray(bundle.aiCoderV6StepHistory) ? bundle.aiCoderV6StepHistory : [];
|
|
1698
|
+
var last = history[history.length - 1];
|
|
1699
|
+
var workflowMemory = bundle.aiCoderV6WorkflowMemory || {};
|
|
1700
|
+
var rows = cleanWorkflowQaRows(workflowMemory.workflowQaRows, 80);
|
|
1701
|
+
var proofArtifacts = cleanList(workflowMemory.businessProofArtifacts, 80, 500);
|
|
1702
|
+
var completedSteps = cleanList(workflowMemory.completedWorkflowSteps, 80, 240);
|
|
1703
|
+
var primaryWorkflowId = cleanText(workflowMemory.primaryWorkflowId || ((_a = rows[0]) === null || _a === void 0 ? void 0 : _a.workflowId), 200);
|
|
1704
|
+
var activeWorkflowStep = cleanText(workflowMemory.activeWorkflowStep || workflowMemory.blockedWorkflowStep || ((_b = rows.find(function (row) { return !statusLooksPassed(row.status); })) === null || _b === void 0 ? void 0 : _b.stepId), 200);
|
|
1705
|
+
var failureClass = cleanText(last === null || last === void 0 ? void 0 : last.failureClass, 120).toLowerCase();
|
|
1706
|
+
var contextReason = cleanText(context.reason, 1000);
|
|
1707
|
+
var observedBlocker = cleanText((last === null || last === void 0 ? void 0 : last.blocker) || (last === null || last === void 0 ? void 0 : last.summary), 1000);
|
|
1708
|
+
var reason = contextReason || observedBlocker;
|
|
1709
|
+
var combinedText = "".concat(failureClass, "\n").concat(contextReason, "\n").concat(observedBlocker, "\n").concat((last === null || last === void 0 ? void 0 : last.stepType) || '', "\n").concat((last === null || last === void 0 ? void 0 : last.lane) || '').toLowerCase();
|
|
1710
|
+
var compileOnly = failureClass === 'compile'
|
|
1711
|
+
|| /\b(compile|typescript|ts[0-9]{3,5}|ng build|cannot find name|module not found)\b/i.test(combinedText);
|
|
1712
|
+
var infraOnly = !compileOnly && (failureClass === 'infra'
|
|
1713
|
+
|| /\b(puppeteer|chrome|browser executable|mongo|port|startup|settings\.json|node_modules|cache|lock)\b/i.test(combinedText));
|
|
1714
|
+
var releaseBlocked = failureClass === 'release'
|
|
1715
|
+
|| context.nextLane === 'publish'
|
|
1716
|
+
|| /\b(release|publish|deploy|cloudfront|artifact|sample data|sample_data)\b/i.test(combinedText);
|
|
1717
|
+
var routeOnlyBlocked = /\b(route only|route-only|route loaded|route_probe|browser route|shell only|shell-only)\b/i.test(combinedText);
|
|
1718
|
+
var sameFailureParked = context.action === 'park'
|
|
1719
|
+
|| context.reason === 'aicoder_v6_repeated_no_progress'
|
|
1720
|
+
|| context.reason === 'aicoder_v6_ping_pong_no_progress';
|
|
1721
|
+
var budgetStopped = context.action === 'budget_stop' || context.budgetExceeded === true;
|
|
1722
|
+
var workflowQaRowsReady = rows.length > 0;
|
|
1723
|
+
var journeyContractReady = !!cleanText(workflowMemory.journeyContractPath, 500)
|
|
1724
|
+
&& (!!primaryWorkflowId || workflowQaRowsReady || completedSteps.length > 0);
|
|
1725
|
+
var businessProofReady = proofArtifacts.length > 0;
|
|
1726
|
+
var status = 'workflow_build_ready';
|
|
1727
|
+
var blockers = [];
|
|
1728
|
+
if (budgetStopped) {
|
|
1729
|
+
status = 'budget_stopped';
|
|
1730
|
+
blockers.push('Budget guard stopped autonomous spend.');
|
|
1731
|
+
}
|
|
1732
|
+
else if (sameFailureParked) {
|
|
1733
|
+
status = 'collect_new_evidence';
|
|
1734
|
+
blockers.push('Same failure class repeated without enough new evidence.');
|
|
1735
|
+
}
|
|
1736
|
+
else if (compileOnly && context.action === 'infra_retry') {
|
|
1737
|
+
status = 'compile_repair_only';
|
|
1738
|
+
blockers.push('Compile/build gate failed; do not count this as product workflow failure.');
|
|
1739
|
+
}
|
|
1740
|
+
else if (infraOnly && context.action === 'infra_retry') {
|
|
1741
|
+
status = 'infra_repair_only';
|
|
1742
|
+
blockers.push('Infra gate failed; repair only environment/browser/startup dependencies.');
|
|
1743
|
+
}
|
|
1744
|
+
else if (failureClass === 'journey' || context.reason === 'aicoder_v6_journey_contract_repair_required') {
|
|
1745
|
+
status = 'journey_contract_repair_required';
|
|
1746
|
+
blockers.push('Journey contract failed validation.');
|
|
1747
|
+
}
|
|
1748
|
+
else if (!journeyContractReady) {
|
|
1749
|
+
status = 'journey_contract_required';
|
|
1750
|
+
blockers.push('Journey contract workflow memory is not ready.');
|
|
1751
|
+
}
|
|
1752
|
+
else if (releaseBlocked || context.reason === 'aicoder_v6_release_repair_required') {
|
|
1753
|
+
status = 'release_repair_required';
|
|
1754
|
+
blockers.push('Release/publish/deploy gate blocks acceptance.');
|
|
1755
|
+
}
|
|
1756
|
+
else if (!workflowQaRowsReady || !businessProofReady || routeOnlyBlocked) {
|
|
1757
|
+
status = 'workflow_qa_required';
|
|
1758
|
+
if (!workflowQaRowsReady) {
|
|
1759
|
+
blockers.push('Workflow QA rows are missing.');
|
|
1760
|
+
}
|
|
1761
|
+
if (!businessProofReady) {
|
|
1762
|
+
blockers.push('AIQaBusinessAssertion proof is missing.');
|
|
1763
|
+
}
|
|
1764
|
+
if (routeOnlyBlocked) {
|
|
1765
|
+
blockers.push('Route/browser proof is not workflow business proof.');
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1768
|
+
else if (businessProofReady) {
|
|
1769
|
+
status = 'workflow_business_proof_ready';
|
|
1770
|
+
}
|
|
1771
|
+
var canRunWorkflowQa = journeyContractReady
|
|
1772
|
+
&& workflowQaRowsReady
|
|
1773
|
+
&& !infraOnly
|
|
1774
|
+
&& !compileOnly
|
|
1775
|
+
&& !sameFailureParked
|
|
1776
|
+
&& !budgetStopped;
|
|
1777
|
+
var canPublish = status === 'workflow_business_proof_ready'
|
|
1778
|
+
&& !releaseBlocked
|
|
1779
|
+
&& !infraOnly
|
|
1780
|
+
&& !compileOnly
|
|
1781
|
+
&& !sameFailureParked
|
|
1782
|
+
&& !budgetStopped;
|
|
1783
|
+
var canRunProductRepair = journeyContractReady
|
|
1784
|
+
&& !infraOnly
|
|
1785
|
+
&& !compileOnly
|
|
1786
|
+
&& !sameFailureParked
|
|
1787
|
+
&& !budgetStopped
|
|
1788
|
+
&& status !== 'journey_contract_repair_required'
|
|
1789
|
+
&& status !== 'release_repair_required'
|
|
1790
|
+
&& status !== 'workflow_business_proof_ready';
|
|
1791
|
+
var nextGate = aicoderWorkflowReadinessGateFor(status);
|
|
1792
|
+
var nextCommand = aicoderWorkflowReadinessNextCommand(status);
|
|
1793
|
+
var workflowProofCheckpoint = buildResolveIOAICoderWorkflowProofCheckpoint({
|
|
1794
|
+
status: status,
|
|
1795
|
+
nextGate: nextGate,
|
|
1796
|
+
nextAction: nextCommand,
|
|
1797
|
+
last: last,
|
|
1798
|
+
journeyContractReady: journeyContractReady,
|
|
1799
|
+
businessProofReady: businessProofReady,
|
|
1800
|
+
routeOnlyBlocked: routeOnlyBlocked,
|
|
1801
|
+
releaseBlocked: releaseBlocked,
|
|
1802
|
+
infraOnly: infraOnly,
|
|
1803
|
+
compileOnly: compileOnly,
|
|
1804
|
+
sameFailureParked: sameFailureParked,
|
|
1805
|
+
primaryWorkflowId: primaryWorkflowId,
|
|
1806
|
+
activeWorkflowStep: activeWorkflowStep,
|
|
1807
|
+
workflowQaRows: rows,
|
|
1808
|
+
businessProofArtifacts: proofArtifacts,
|
|
1809
|
+
completedWorkflowSteps: completedSteps
|
|
1810
|
+
});
|
|
1811
|
+
return {
|
|
1812
|
+
status: status,
|
|
1813
|
+
nextGate: nextGate,
|
|
1814
|
+
nextLane: context.nextLane || (last === null || last === void 0 ? void 0 : last.lane) || bundle.aiCoderV6SupervisorState.activeLane,
|
|
1815
|
+
nextStep: context.nextStep || (last === null || last === void 0 ? void 0 : last.stepType) || bundle.aiCoderV6SupervisorState.activeStep,
|
|
1816
|
+
nextCommand: nextCommand,
|
|
1817
|
+
journeyContractReady: journeyContractReady,
|
|
1818
|
+
workflowQaRowsReady: workflowQaRowsReady,
|
|
1819
|
+
businessProofReady: businessProofReady,
|
|
1820
|
+
routeOnlyBlocked: routeOnlyBlocked,
|
|
1821
|
+
releaseBlocked: releaseBlocked,
|
|
1822
|
+
infraOnly: infraOnly,
|
|
1823
|
+
compileOnly: compileOnly,
|
|
1824
|
+
sameFailureParked: sameFailureParked,
|
|
1825
|
+
canRunProductRepair: canRunProductRepair,
|
|
1826
|
+
canRunWorkflowQa: canRunWorkflowQa,
|
|
1827
|
+
canPublish: canPublish,
|
|
1828
|
+
canPolishWowUi: canPublish,
|
|
1829
|
+
requiresHumanDecision: budgetStopped || sameFailureParked,
|
|
1830
|
+
reason: reason || aicoderWorkflowReadinessNextCommand(status),
|
|
1831
|
+
blockers: blockers.slice(0, 8),
|
|
1832
|
+
primaryWorkflowId: primaryWorkflowId,
|
|
1833
|
+
activeWorkflowStep: activeWorkflowStep,
|
|
1834
|
+
businessProofArtifacts: proofArtifacts,
|
|
1835
|
+
workflowProofCheckpoint: workflowProofCheckpoint
|
|
1836
|
+
};
|
|
1837
|
+
}
|
|
1838
|
+
function aicoderNextActionLabel(command) {
|
|
1839
|
+
switch (command) {
|
|
1840
|
+
case 'repair_aicoder_journey_contract':
|
|
1841
|
+
return 'Repair Journey Contract';
|
|
1842
|
+
case 'run_aicoder_workflow_build':
|
|
1843
|
+
return 'Build North-Star Workflow';
|
|
1844
|
+
case 'run_aicoder_workflow_qa':
|
|
1845
|
+
return 'Run Workflow QA';
|
|
1846
|
+
case 'repair_aicoder_release_gate':
|
|
1847
|
+
return 'Repair Release Gate';
|
|
1848
|
+
case 'repair_aicoder_compile_gate':
|
|
1849
|
+
return 'Repair Compile Gate';
|
|
1850
|
+
case 'repair_aicoder_infra_gate':
|
|
1851
|
+
return 'Repair Infra Gate';
|
|
1852
|
+
case 'run_aicoder_owner_scoped_repair':
|
|
1853
|
+
return 'Run Scoped Repair';
|
|
1854
|
+
case 'publish_aicoder_after_workflow_proof':
|
|
1855
|
+
return 'Publish After Workflow Proof';
|
|
1856
|
+
case 'park_aicoder_until_new_evidence':
|
|
1857
|
+
return 'Park Until New Evidence';
|
|
1858
|
+
case 'park_aicoder_budget_stop':
|
|
1859
|
+
return 'Park Budget Stop';
|
|
1860
|
+
default:
|
|
1861
|
+
return 'Continue Workflow';
|
|
1862
|
+
}
|
|
1863
|
+
}
|
|
1864
|
+
function aicoderNextActionPrimaryCommand(action, readiness) {
|
|
1865
|
+
if (action === 'budget_stop') {
|
|
1866
|
+
return 'park_aicoder_budget_stop';
|
|
1867
|
+
}
|
|
1868
|
+
if (action === 'park') {
|
|
1869
|
+
return 'park_aicoder_until_new_evidence';
|
|
1870
|
+
}
|
|
1871
|
+
if (action === 'infra_retry') {
|
|
1872
|
+
return readiness.compileOnly ? 'repair_aicoder_compile_gate' : 'repair_aicoder_infra_gate';
|
|
1873
|
+
}
|
|
1874
|
+
if (readiness.status === 'journey_contract_required' || readiness.status === 'journey_contract_repair_required') {
|
|
1875
|
+
return 'repair_aicoder_journey_contract';
|
|
1876
|
+
}
|
|
1877
|
+
if (readiness.status === 'workflow_build_ready') {
|
|
1878
|
+
return 'run_aicoder_workflow_build';
|
|
1879
|
+
}
|
|
1880
|
+
if (readiness.status === 'workflow_qa_required') {
|
|
1881
|
+
return 'run_aicoder_workflow_qa';
|
|
1882
|
+
}
|
|
1883
|
+
if (readiness.status === 'release_repair_required') {
|
|
1884
|
+
return 'repair_aicoder_release_gate';
|
|
1885
|
+
}
|
|
1886
|
+
if (action === 'ready_to_publish') {
|
|
1887
|
+
return 'publish_aicoder_after_workflow_proof';
|
|
1888
|
+
}
|
|
1889
|
+
if (action === 'switch_to_repair' || action === 'retry_same_step') {
|
|
1890
|
+
return 'run_aicoder_owner_scoped_repair';
|
|
1891
|
+
}
|
|
1892
|
+
return 'continue_aicoder_workflow';
|
|
1893
|
+
}
|
|
1894
|
+
function aicoderNextActionCostRisk(action, command, readiness) {
|
|
1895
|
+
if (action === 'park' || action === 'budget_stop' || readiness.requiresHumanDecision) {
|
|
1896
|
+
return 'manual_blocked';
|
|
1897
|
+
}
|
|
1898
|
+
if (action === 'ready_to_publish' || command === 'repair_aicoder_release_gate' || readiness.nextGate === 'release') {
|
|
1899
|
+
return 'release_or_customer_send';
|
|
1900
|
+
}
|
|
1901
|
+
if (command === 'run_aicoder_workflow_qa' || command === 'repair_aicoder_compile_gate' || command === 'repair_aicoder_infra_gate') {
|
|
1902
|
+
return 'small_model_or_qa';
|
|
1903
|
+
}
|
|
1904
|
+
if (command === 'continue_aicoder_workflow') {
|
|
1905
|
+
return 'free_or_deterministic';
|
|
1906
|
+
}
|
|
1907
|
+
return 'expensive_model';
|
|
1908
|
+
}
|
|
1909
|
+
function aicoderNextActionExpectedTransition(command) {
|
|
1910
|
+
switch (command) {
|
|
1911
|
+
case 'repair_aicoder_journey_contract':
|
|
1912
|
+
return 'Missing or invalid journey contract becomes a validated first/next/last workflow graph with QA rows.';
|
|
1913
|
+
case 'run_aicoder_workflow_build':
|
|
1914
|
+
return 'Journey contract becomes implemented workflow screens, hub action, data story, and reachable completion state.';
|
|
1915
|
+
case 'run_aicoder_workflow_qa':
|
|
1916
|
+
return 'Route/browser evidence becomes AIQaBusinessAssertion proof for the north-star workflow.';
|
|
1917
|
+
case 'repair_aicoder_release_gate':
|
|
1918
|
+
return 'Publish/deploy/sample-data blocker becomes hotfix evidence, release-gate evidence, or one explicit force-deploy decision.';
|
|
1919
|
+
case 'repair_aicoder_compile_gate':
|
|
1920
|
+
return 'Compile failure becomes a passing build or a new compile blocker fingerprint.';
|
|
1921
|
+
case 'repair_aicoder_infra_gate':
|
|
1922
|
+
return 'Infra/preflight failure becomes a passing startup/browser/Mongo gate or a new infra blocker fingerprint.';
|
|
1923
|
+
case 'run_aicoder_owner_scoped_repair':
|
|
1924
|
+
return 'Current blocker changes to passed, a new evidence hash, or a parked manual decision.';
|
|
1925
|
+
case 'publish_aicoder_after_workflow_proof':
|
|
1926
|
+
return 'Workflow-proven artifact moves through the release gate exactly once with publish/deploy evidence recorded.';
|
|
1927
|
+
case 'park_aicoder_budget_stop':
|
|
1928
|
+
case 'park_aicoder_until_new_evidence':
|
|
1929
|
+
return 'Runner stops spending until an operator records new evidence or an explicit next action.';
|
|
1930
|
+
default:
|
|
1931
|
+
return 'Runner advances to the next workflow-first gate with evidence recorded.';
|
|
1932
|
+
}
|
|
1933
|
+
}
|
|
1934
|
+
function buildResolveIOAICoderNextActionStopConditions(readiness, command) {
|
|
1935
|
+
var stopConditions = [
|
|
1936
|
+
'Do not accept scorecard, wow score, or route load as app success without AIQaBusinessAssertion workflow proof.'
|
|
1937
|
+
];
|
|
1938
|
+
if (!readiness.journeyContractReady || command === 'repair_aicoder_journey_contract') {
|
|
1939
|
+
stopConditions.push('Do not run build tasks until docs/APP_JOURNEY_CONTRACT.md validates with first/next/last workflow steps.');
|
|
1940
|
+
}
|
|
1941
|
+
if (!readiness.businessProofReady || readiness.routeOnlyBlocked || command === 'run_aicoder_workflow_qa') {
|
|
1942
|
+
stopConditions.push('Do not publish or run wow UI polish until workflow business proof passes.');
|
|
1943
|
+
stopConditions.push('Route-only proof must stay labeled as route evidence, not acceptance.');
|
|
1944
|
+
}
|
|
1945
|
+
if (readiness.releaseBlocked || command === 'repair_aicoder_release_gate') {
|
|
1946
|
+
stopConditions.push('Do not repeat a full publish/deploy until release blocker evidence changes or hotfix/force evidence is recorded.');
|
|
1947
|
+
}
|
|
1948
|
+
if (readiness.infraOnly || readiness.compileOnly) {
|
|
1949
|
+
stopConditions.push('Infra, startup, Puppeteer, Chrome, Mongo, and compile failures stay in infra/compile repair; do not charge them as product workflow failure.');
|
|
1950
|
+
}
|
|
1951
|
+
if (readiness.sameFailureParked) {
|
|
1952
|
+
stopConditions.push('Do not retry the same model/code repair until the blocker fingerprint, evidence hash, or workflow proof artifact changes.');
|
|
1953
|
+
}
|
|
1954
|
+
if (readiness.requiresHumanDecision) {
|
|
1955
|
+
stopConditions.push('Do not spend additional model or release budget until an operator records the next bounded action.');
|
|
1956
|
+
}
|
|
1957
|
+
return Array.from(new Set(stopConditions)).slice(0, 12);
|
|
1958
|
+
}
|
|
1959
|
+
function buildResolveIOAICoderNextActionContract(input) {
|
|
1960
|
+
var workflowReadiness = input.workflowReadiness;
|
|
1961
|
+
var workflowProofCheckpoint = input.workflowProofCheckpoint;
|
|
1962
|
+
var history = Array.isArray(input.bundle.aiCoderV6StepHistory) ? input.bundle.aiCoderV6StepHistory : [];
|
|
1963
|
+
var last = history[history.length - 1];
|
|
1964
|
+
var command = aicoderNextActionPrimaryCommand(input.action, workflowReadiness);
|
|
1965
|
+
var costRisk = aicoderNextActionCostRisk(input.action, command, workflowReadiness);
|
|
1966
|
+
var hotfixCommitRequired = command === 'repair_aicoder_release_gate'
|
|
1967
|
+
|| workflowReadiness.releaseBlocked
|
|
1968
|
+
|| workflowReadiness.nextGate === 'release';
|
|
1969
|
+
var liveHotfixBlockedUntilCommit = hotfixCommitRequired;
|
|
1970
|
+
var requiredHotfixCommitProof = hotfixCommitRequired
|
|
1971
|
+
? ['sourceCommitSha', 'githubCommitUrl', 'gitCommitStatus=passed', 'gitPushStatus=passed']
|
|
1972
|
+
: [];
|
|
1973
|
+
var requiresHumanApproval = input.action === 'park'
|
|
1974
|
+
|| input.action === 'budget_stop'
|
|
1975
|
+
|| input.action === 'ready_to_publish'
|
|
1976
|
+
|| input.budgetExceeded === true
|
|
1977
|
+
|| workflowReadiness.requiresHumanDecision === true;
|
|
1978
|
+
var workflowFirstSatisfied = workflowReadiness.journeyContractReady
|
|
1979
|
+
&& workflowReadiness.businessProofReady
|
|
1980
|
+
&& !workflowReadiness.releaseBlocked
|
|
1981
|
+
&& !workflowReadiness.routeOnlyBlocked
|
|
1982
|
+
&& !workflowReadiness.infraOnly
|
|
1983
|
+
&& !workflowReadiness.compileOnly
|
|
1984
|
+
&& !workflowReadiness.sameFailureParked;
|
|
1985
|
+
var safeToAutoRun = !requiresHumanApproval && (command === 'repair_aicoder_journey_contract'
|
|
1986
|
+
|| command === 'run_aicoder_workflow_build'
|
|
1987
|
+
|| command === 'run_aicoder_workflow_qa'
|
|
1988
|
+
|| command === 'repair_aicoder_release_gate'
|
|
1989
|
+
|| command === 'repair_aicoder_compile_gate'
|
|
1990
|
+
|| command === 'repair_aicoder_infra_gate'
|
|
1991
|
+
|| (command === 'run_aicoder_owner_scoped_repair' && workflowReadiness.canRunProductRepair)
|
|
1992
|
+
|| (command === 'continue_aicoder_workflow' && !workflowReadiness.blockers.length));
|
|
1993
|
+
var canRunWithoutCodexMonitor = safeToAutoRun
|
|
1994
|
+
&& workflowProofCheckpoint.requiredEvidence.length > 0
|
|
1995
|
+
&& workflowProofCheckpoint.nextAction.length > 0;
|
|
1996
|
+
var blockers = Array.from(new Set(__spreadArray(__spreadArray([], __read(workflowReadiness.blockers), false), __read((workflowProofCheckpoint.status === 'waiting_for_new_evidence' ? workflowProofCheckpoint.requiredResetEvidence : [])), false))).slice(0, 12);
|
|
1997
|
+
var preconditions = Array.from(new Set(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([
|
|
1998
|
+
workflowProofCheckpoint.nextAction
|
|
1999
|
+
], __read(workflowProofCheckpoint.requiredEvidence), false), __read((workflowReadiness.journeyContractReady ? [] : ['validated APP_JOURNEY_CONTRACT.md journey_contract JSON'])), false), __read((workflowReadiness.canRunWorkflowQa ? ['workflow QA rows generated from the journey contract'] : [])), false), __read((workflowReadiness.releaseBlocked ? ['release blocker artifact or hotfix-first release evidence'] : [])), false), __read((hotfixCommitRequired ? ['sourceCommitSha, githubCommitUrl, passed gitCommitStatus, and passed gitPushStatus before live hotfix apply'] : [])), false).map(function (entry) { return cleanText(entry, 300); }).filter(Boolean))).slice(0, 12);
|
|
2000
|
+
var successEvidence = Array.from(new Set(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(workflowProofCheckpoint.requiredEvidence), false), __read((workflowReadiness.businessProofReady ? ['retained AIQaBusinessAssertion artifact'] : [])), false), __read((workflowReadiness.canPublish ? ['release gate accepts the workflow-proven artifact'] : [])), false), __read((command === 'repair_aicoder_release_gate' ? ['hotfix evidence or explicit one-time force release decision'] : [])), false), __read((hotfixCommitRequired ? ['GitHub commit and push proof for any manager-applied hotfix'] : [])), false).map(function (entry) { return cleanText(entry, 300); }).filter(Boolean))).slice(0, 12);
|
|
2001
|
+
var stopConditions = buildResolveIOAICoderNextActionStopConditions(workflowReadiness, command);
|
|
2002
|
+
if (hotfixCommitRequired) {
|
|
2003
|
+
stopConditions.push('Do not apply a live AICoder backend/static hotfix until sourceCommitSha, githubCommitUrl, passed gitCommitStatus, and passed gitPushStatus are recorded.');
|
|
2004
|
+
}
|
|
2005
|
+
var forbiddenActions = Array.from(new Set(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([
|
|
2006
|
+
'accepting route-only proof as app success',
|
|
2007
|
+
'accepting scorecard-only or wow-score-only proof as app success'
|
|
2008
|
+
], __read((workflowReadiness.journeyContractReady ? [] : ['building product routes before the journey contract validates'])), false), __read((workflowReadiness.businessProofReady ? [] : ['publishing before north-star workflow business proof passes'])), false), __read((workflowReadiness.releaseBlocked ? ['rerunning full deploy/publish without changed release evidence'] : [])), false), __read((hotfixCommitRequired ? ['applying live hotfix before pushed GitHub commit proof'] : [])), false), __read((workflowReadiness.sameFailureParked ? ['retrying the same repair loop without new evidence'] : [])), false))).slice(0, 12);
|
|
2009
|
+
var nextCommands = Array.from(new Set(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([
|
|
2010
|
+
command
|
|
2011
|
+
], __read((command === 'repair_aicoder_journey_contract' ? ['validate_aicoder_journey_contract', 'generate_workflow_qa_rows'] : [])), false), __read((command === 'run_aicoder_workflow_qa' ? ['execute_contract_qa_assertions', 'record_aiqa_business_assertion'] : [])), false), __read((command === 'repair_aicoder_release_gate' ? [
|
|
2012
|
+
'collect_release_blocker_evidence',
|
|
2013
|
+
'prefer_hotfix_before_full_deploy',
|
|
2014
|
+
'prepare_hotfix_patch_without_live_apply',
|
|
2015
|
+
'commit_and_push_hotfix_to_github',
|
|
2016
|
+
'record_github_commit_for_hotfix',
|
|
2017
|
+
'apply_live_hotfix_only_after_github_commit_proof'
|
|
2018
|
+
] : [])), false), __read((command === 'repair_aicoder_compile_gate' ? ['rerun_compile_gate_only', 'record_compile_evidence_hash'] : [])), false), __read((command === 'repair_aicoder_infra_gate' ? ['rerun_preflight_gate_only', 'record_infra_evidence_hash'] : [])), false), [
|
|
2019
|
+
'record_aicoder_next_action_result'
|
|
2020
|
+
], false))).slice(0, 12);
|
|
2021
|
+
var contractBasis = {
|
|
2022
|
+
action: input.action,
|
|
2023
|
+
reason: cleanText(input.reason, 500),
|
|
2024
|
+
command: command,
|
|
2025
|
+
readinessStatus: workflowReadiness.status,
|
|
2026
|
+
checkpointStatus: workflowProofCheckpoint.status,
|
|
2027
|
+
failureClass: cleanText(last === null || last === void 0 ? void 0 : last.failureClass, 120),
|
|
2028
|
+
evidenceHash: (0, ai_runner_manager_policy_1.hashResolveIOAIManagerEvidence)(last)
|
|
2029
|
+
};
|
|
2030
|
+
return {
|
|
2031
|
+
contractId: "aicoder-next-".concat((0, ai_runner_manager_policy_1.hashResolveIOAIManagerEvidence)({
|
|
2032
|
+
failureClass: contractBasis.failureClass,
|
|
2033
|
+
summary: "".concat(contractBasis.reason, ":").concat(contractBasis.command, ":").concat(contractBasis.readinessStatus, ":").concat(contractBasis.checkpointStatus),
|
|
2034
|
+
evidenceHash: contractBasis.evidenceHash,
|
|
2035
|
+
changedFiles: last === null || last === void 0 ? void 0 : last.changedFiles,
|
|
2036
|
+
artifactPaths: last === null || last === void 0 ? void 0 : last.artifactPaths
|
|
2037
|
+
})),
|
|
2038
|
+
action: input.action,
|
|
2039
|
+
label: aicoderNextActionLabel(command),
|
|
2040
|
+
primaryCommand: command,
|
|
2041
|
+
lane: input.nextLane,
|
|
2042
|
+
stepType: input.nextStep,
|
|
2043
|
+
safeToAutoRun: safeToAutoRun,
|
|
2044
|
+
requiresHumanApproval: requiresHumanApproval,
|
|
2045
|
+
canRunWithoutCodexMonitor: canRunWithoutCodexMonitor,
|
|
2046
|
+
codexFallbackRequired: !canRunWithoutCodexMonitor && !requiresHumanApproval,
|
|
2047
|
+
codexFallbackReason: canRunWithoutCodexMonitor
|
|
2048
|
+
? ''
|
|
2049
|
+
: requiresHumanApproval
|
|
2050
|
+
? 'Operator approval is required before the next action.'
|
|
2051
|
+
: 'Next action needs stronger deterministic evidence before it can run unattended.',
|
|
2052
|
+
costRisk: costRisk,
|
|
2053
|
+
workflowFirstSatisfied: workflowFirstSatisfied,
|
|
2054
|
+
decisionBasis: {
|
|
2055
|
+
journeyContractReady: workflowReadiness.journeyContractReady,
|
|
2056
|
+
workflowProofReady: workflowReadiness.businessProofReady,
|
|
2057
|
+
sampleDataReady: workflowReadiness.businessProofReady && !workflowReadiness.releaseBlocked,
|
|
2058
|
+
releaseBlocked: workflowReadiness.releaseBlocked,
|
|
2059
|
+
routeOnlyBlocked: workflowReadiness.routeOnlyBlocked,
|
|
2060
|
+
infraOnly: workflowReadiness.infraOnly,
|
|
2061
|
+
compileOnly: workflowReadiness.compileOnly,
|
|
2062
|
+
sameFailureParked: workflowReadiness.sameFailureParked,
|
|
2063
|
+
canPublish: workflowReadiness.canPublish,
|
|
2064
|
+
canPolishWowUi: workflowReadiness.canPolishWowUi,
|
|
2065
|
+
workflowReadinessStatus: workflowReadiness.status,
|
|
2066
|
+
workflowProofCheckpointStatus: workflowProofCheckpoint.status,
|
|
2067
|
+
failureClass: contractBasis.failureClass,
|
|
2068
|
+
evidenceHash: cleanText((last === null || last === void 0 ? void 0 : last.evidenceHash) || contractBasis.evidenceHash, 160),
|
|
2069
|
+
hotfixCommitRequired: hotfixCommitRequired,
|
|
2070
|
+
liveHotfixBlockedUntilCommit: liveHotfixBlockedUntilCommit
|
|
2071
|
+
},
|
|
2072
|
+
preconditions: preconditions,
|
|
2073
|
+
expectedStateTransition: aicoderNextActionExpectedTransition(command),
|
|
2074
|
+
successEvidence: successEvidence,
|
|
2075
|
+
requiredHotfixCommitProof: requiredHotfixCommitProof,
|
|
2076
|
+
stopConditions: stopConditions,
|
|
2077
|
+
forbiddenActions: forbiddenActions,
|
|
2078
|
+
nextCommands: nextCommands,
|
|
2079
|
+
blockers: blockers,
|
|
2080
|
+
ownerFiles: cleanList(last === null || last === void 0 ? void 0 : last.changedFiles, 20, 500),
|
|
2081
|
+
createdAt: isoNow(input.now)
|
|
2082
|
+
};
|
|
2083
|
+
}
|
|
2084
|
+
function buildResolveIOAICoderV6Budget(existing) {
|
|
2085
|
+
return {
|
|
2086
|
+
maxPromptTokensPerNonInitialStep: Number((existing === null || existing === void 0 ? void 0 : existing.maxPromptTokensPerNonInitialStep) || 4000),
|
|
2087
|
+
maxTotalPromptTokens: Number((existing === null || existing === void 0 ? void 0 : existing.maxTotalPromptTokens) || 120000),
|
|
2088
|
+
maxLoopsPerRun: Number((existing === null || existing === void 0 ? void 0 : existing.maxLoopsPerRun) || 24),
|
|
2089
|
+
maxRepeatedNoProgress: Number((existing === null || existing === void 0 ? void 0 : existing.maxRepeatedNoProgress) || 2),
|
|
2090
|
+
maxRuntimeMinutesPerLane: Number((existing === null || existing === void 0 ? void 0 : existing.maxRuntimeMinutesPerLane) || 30),
|
|
2091
|
+
softBudgetUsd: Number((existing === null || existing === void 0 ? void 0 : existing.softBudgetUsd) || 30),
|
|
2092
|
+
hardBudgetUsd: Number((existing === null || existing === void 0 ? void 0 : existing.hardBudgetUsd) || 60),
|
|
2093
|
+
totalPromptTokenEstimate: cleanNumber(existing === null || existing === void 0 ? void 0 : existing.totalPromptTokenEstimate),
|
|
2094
|
+
totalInputTokens: cleanNumber(existing === null || existing === void 0 ? void 0 : existing.totalInputTokens),
|
|
2095
|
+
totalCachedInputTokens: cleanNumber(existing === null || existing === void 0 ? void 0 : existing.totalCachedInputTokens),
|
|
2096
|
+
totalOutputTokens: cleanNumber(existing === null || existing === void 0 ? void 0 : existing.totalOutputTokens),
|
|
2097
|
+
totalRuntimeMs: cleanNumber(existing === null || existing === void 0 ? void 0 : existing.totalRuntimeMs),
|
|
2098
|
+
loopCount: cleanNumber(existing === null || existing === void 0 ? void 0 : existing.loopCount)
|
|
2099
|
+
};
|
|
2100
|
+
}
|
|
2101
|
+
function initializeResolveIOAICoderV6State(input) {
|
|
2102
|
+
var now = isoNow(input.now);
|
|
2103
|
+
var existing = input.existing || {};
|
|
2104
|
+
var existingSupervisor = existing.aiCoderV6SupervisorState;
|
|
2105
|
+
var existingLaneMemory = existing.aiCoderV6LaneMemory || {};
|
|
2106
|
+
var existingWorkflowMemory = existing.aiCoderV6WorkflowMemory || {};
|
|
2107
|
+
var scope = cleanList(input.approvedScopeRequirements, 24, 240).join(' | ')
|
|
2108
|
+
|| cleanText(input.description, 1000)
|
|
2109
|
+
|| cleanText(input.title, 300);
|
|
2110
|
+
var runId = cleanText(input.conversationId || input.jobId || input.appId, 120);
|
|
2111
|
+
var defaultModel = cleanText(input.defaultModel || 'gpt-5.3-codex', 80);
|
|
2112
|
+
var buildLaneMemory = function (lane) {
|
|
2113
|
+
var _a;
|
|
2114
|
+
var previous = existingLaneMemory[lane] || {};
|
|
2115
|
+
return {
|
|
2116
|
+
lane: lane,
|
|
2117
|
+
model: cleanText(previous.model || defaultModel, 80),
|
|
2118
|
+
threadKey: cleanText(((_a = input.laneThreadKeys) === null || _a === void 0 ? void 0 : _a[lane]) || previous.threadKey || "aicoder:".concat(input.runKind, ":").concat(runId, ":").concat(lane), 240),
|
|
2119
|
+
scopeSummary: cleanText(previous.scopeSummary || scope, 1200),
|
|
2120
|
+
activeStep: previous.activeStep || (lane === 'plan' ? 'plan' : lane === 'qa' ? 'qa' : lane === 'review' ? 'review' : lane === 'publish' ? 'publish' : 'task'),
|
|
2121
|
+
activeBlocker: cleanText(previous.activeBlocker, 1200),
|
|
2122
|
+
activeQaRow: previous.activeQaRow,
|
|
2123
|
+
changedFiles: cleanList(previous.changedFiles, 80, 500),
|
|
2124
|
+
artifactPaths: cleanList(previous.artifactPaths, 80, 500),
|
|
2125
|
+
latestPromptVersion: cleanText(previous.latestPromptVersion, 120) || undefined,
|
|
2126
|
+
latestPromptTokenEstimate: cleanNumber(previous.latestPromptTokenEstimate) || undefined,
|
|
2127
|
+
updatedAt: previous.updatedAt || now
|
|
2128
|
+
};
|
|
2129
|
+
};
|
|
2130
|
+
var laneMemory = LANES.reduce(function (accumulator, lane) {
|
|
2131
|
+
accumulator[lane] = buildLaneMemory(lane);
|
|
2132
|
+
return accumulator;
|
|
2133
|
+
}, {});
|
|
2134
|
+
var activeLane = (existingSupervisor === null || existingSupervisor === void 0 ? void 0 : existingSupervisor.activeLane) || (input.runKind === 'initial_builder' ? 'plan' : 'build');
|
|
2135
|
+
return {
|
|
2136
|
+
aiCoderRunnerVersion: 'v6',
|
|
2137
|
+
aiCoderV6SupervisorState: {
|
|
2138
|
+
version: 'v6',
|
|
2139
|
+
runKind: input.runKind,
|
|
2140
|
+
status: (existingSupervisor === null || existingSupervisor === void 0 ? void 0 : existingSupervisor.status) || 'active',
|
|
2141
|
+
currentGoal: cleanText((existingSupervisor === null || existingSupervisor === void 0 ? void 0 : existingSupervisor.currentGoal) || "Run AICoder ".concat(input.runKind, " ").concat(runId), 500),
|
|
2142
|
+
approvedScope: cleanText((existingSupervisor === null || existingSupervisor === void 0 ? void 0 : existingSupervisor.approvedScope) || scope, 1400),
|
|
2143
|
+
branchName: cleanText(input.branchName || (existingSupervisor === null || existingSupervisor === void 0 ? void 0 : existingSupervisor.branchName), 240),
|
|
2144
|
+
activeLane: activeLane,
|
|
2145
|
+
activeStep: (existingSupervisor === null || existingSupervisor === void 0 ? void 0 : existingSupervisor.activeStep) || laneMemory[activeLane].activeStep,
|
|
2146
|
+
activeBlocker: cleanText(existingSupervisor === null || existingSupervisor === void 0 ? void 0 : existingSupervisor.activeBlocker, 1200),
|
|
2147
|
+
lastGoodCheckpoint: (existingSupervisor === null || existingSupervisor === void 0 ? void 0 : existingSupervisor.lastGoodCheckpoint) || 'v6_initialized',
|
|
2148
|
+
lastGoodCommit: cleanText(existingSupervisor === null || existingSupervisor === void 0 ? void 0 : existingSupervisor.lastGoodCommit, 240) || undefined,
|
|
2149
|
+
testDeployStatus: cleanText(existingSupervisor === null || existingSupervisor === void 0 ? void 0 : existingSupervisor.testDeployStatus, 120) || undefined,
|
|
2150
|
+
liveDeployStatus: cleanText(existingSupervisor === null || existingSupervisor === void 0 ? void 0 : existingSupervisor.liveDeployStatus, 120) || undefined,
|
|
2151
|
+
processLease: input.processLease || (existingSupervisor === null || existingSupervisor === void 0 ? void 0 : existingSupervisor.processLease),
|
|
2152
|
+
artifactLinks: cleanList(existingSupervisor === null || existingSupervisor === void 0 ? void 0 : existingSupervisor.artifactLinks, 80, 500),
|
|
2153
|
+
updatedAt: now
|
|
2154
|
+
},
|
|
2155
|
+
aiCoderV6LaneMemory: laneMemory,
|
|
2156
|
+
aiCoderV6WorkflowMemory: {
|
|
2157
|
+
journeyContractPath: cleanText(input.journeyContractPath || existingWorkflowMemory.journeyContractPath || 'docs/APP_JOURNEY_CONTRACT.md', 500),
|
|
2158
|
+
primaryWorkflowId: cleanText(existingWorkflowMemory.primaryWorkflowId, 200),
|
|
2159
|
+
activeWorkflowStep: cleanText(existingWorkflowMemory.activeWorkflowStep, 200),
|
|
2160
|
+
workflowQaRows: cleanWorkflowQaRows(existingWorkflowMemory.workflowQaRows, 80),
|
|
2161
|
+
completedWorkflowSteps: cleanList(existingWorkflowMemory.completedWorkflowSteps, 80, 240),
|
|
2162
|
+
blockedWorkflowStep: cleanText(existingWorkflowMemory.blockedWorkflowStep, 240),
|
|
2163
|
+
businessProofArtifacts: cleanList(existingWorkflowMemory.businessProofArtifacts, 80, 500),
|
|
2164
|
+
updatedAt: existingWorkflowMemory.updatedAt || now
|
|
2165
|
+
},
|
|
2166
|
+
aiCoderV6StepHistory: Array.isArray(existing.aiCoderV6StepHistory)
|
|
2167
|
+
? existing.aiCoderV6StepHistory.slice(-100)
|
|
2168
|
+
: [],
|
|
2169
|
+
aiCoderV6Budget: buildResolveIOAICoderV6Budget(existing.aiCoderV6Budget),
|
|
2170
|
+
aiCoderV6RunnerIncidents: Array.isArray(existing.aiCoderV6RunnerIncidents)
|
|
2171
|
+
? existing.aiCoderV6RunnerIncidents.slice(-100)
|
|
2172
|
+
: [],
|
|
2173
|
+
aiCoderV6RecoveryPlan: existing.aiCoderV6RecoveryPlan,
|
|
2174
|
+
aiCoderV6RecoveryCheckpoint: existing.aiCoderV6RecoveryCheckpoint,
|
|
2175
|
+
aiCoderV6RecoveryEvidenceProbe: existing.aiCoderV6RecoveryEvidenceProbe,
|
|
2176
|
+
aiCoderV6RecoveryAction: existing.aiCoderV6RecoveryAction,
|
|
2177
|
+
aiCoderV6RecoveryDispatchHistory: Array.isArray(existing.aiCoderV6RecoveryDispatchHistory)
|
|
2178
|
+
? existing.aiCoderV6RecoveryDispatchHistory.slice(-50)
|
|
2179
|
+
: [],
|
|
2180
|
+
aiCoderV6RecoveryDirective: existing.aiCoderV6RecoveryDirective
|
|
2181
|
+
};
|
|
2182
|
+
}
|
|
2183
|
+
function recordResolveIOAICoderV6Step(bundle, step) {
|
|
2184
|
+
var _a;
|
|
2185
|
+
var _b, _c;
|
|
2186
|
+
var now = isoNow(step.now);
|
|
2187
|
+
var promptTokens = cleanNumber(step.promptTokenEstimate);
|
|
2188
|
+
var inputTokens = cleanNumber(step.inputTokens);
|
|
2189
|
+
var cachedInputTokens = cleanNumber(step.cachedInputTokens);
|
|
2190
|
+
var outputTokens = cleanNumber(step.outputTokens);
|
|
2191
|
+
var runtimeMs = cleanNumber(step.runtimeMs);
|
|
2192
|
+
var blocker = cleanText(step.blocker, 1200);
|
|
2193
|
+
var failureClass = classifyResolveIOAICoderV6FailureClass({
|
|
2194
|
+
outcome: step.outcome,
|
|
2195
|
+
lane: step.lane,
|
|
2196
|
+
stepType: step.stepType,
|
|
2197
|
+
blocker: blocker,
|
|
2198
|
+
summary: step.summary,
|
|
2199
|
+
failureClass: step.failureClass
|
|
2200
|
+
});
|
|
2201
|
+
var previousWorkflowMemory = bundle.aiCoderV6WorkflowMemory || {};
|
|
2202
|
+
var activeWorkflowStep = cleanText(step.activeWorkflowStep || previousWorkflowMemory.activeWorkflowStep, 200);
|
|
2203
|
+
var explicitCompletedSteps = cleanList(step.completedWorkflowSteps, 40, 240);
|
|
2204
|
+
var completedWorkflowSteps = Array.from(new Set(__spreadArray(__spreadArray(__spreadArray([], __read(cleanList(previousWorkflowMemory.completedWorkflowSteps, 80, 240)), false), __read(explicitCompletedSteps), false), __read((step.outcome === 'pass' && activeWorkflowStep ? [activeWorkflowStep] : [])), false))).slice(-80);
|
|
2205
|
+
var businessProofArtifacts = Array.from(new Set(__spreadArray(__spreadArray([], __read(cleanList(previousWorkflowMemory.businessProofArtifacts, 80, 500)), false), __read(cleanList(step.businessProofArtifacts, 40, 500)), false))).slice(-80);
|
|
2206
|
+
var workflowQaRows = step.workflowQaRows !== undefined
|
|
2207
|
+
? cleanWorkflowQaRows(step.workflowQaRows, 80)
|
|
2208
|
+
: cleanWorkflowQaRows(previousWorkflowMemory.workflowQaRows, 80);
|
|
2209
|
+
var blockedWorkflowStep = cleanText(step.blockedWorkflowStep
|
|
2210
|
+
|| ((step.outcome === 'needs_repair' || step.outcome === 'park_manual') ? activeWorkflowStep : '')
|
|
2211
|
+
|| previousWorkflowMemory.blockedWorkflowStep, 240);
|
|
2212
|
+
var record = {
|
|
2213
|
+
stepType: step.stepType,
|
|
2214
|
+
outcome: step.outcome,
|
|
2215
|
+
lane: step.lane,
|
|
2216
|
+
model: cleanText(step.model, 80) || undefined,
|
|
2217
|
+
threadKey: cleanText(step.threadKey, 240) || undefined,
|
|
2218
|
+
promptVersion: cleanText(step.promptVersion, 120) || undefined,
|
|
2219
|
+
promptTokenEstimate: promptTokens || undefined,
|
|
2220
|
+
inputTokens: inputTokens || undefined,
|
|
2221
|
+
cachedInputTokens: cachedInputTokens || undefined,
|
|
2222
|
+
outputTokens: outputTokens || undefined,
|
|
2223
|
+
runtimeMs: runtimeMs || undefined,
|
|
2224
|
+
summary: cleanText(step.summary || blocker || step.outcome, 1200),
|
|
2225
|
+
blocker: blocker || undefined,
|
|
2226
|
+
blockerFingerprint: blocker ? fingerprintResolveIOAICoderV6Blocker(blocker) : undefined,
|
|
2227
|
+
failureClass: failureClass,
|
|
2228
|
+
changedFiles: cleanList(step.changedFiles, 80, 500),
|
|
2229
|
+
artifactPaths: cleanList(step.artifactPaths, 80, 500),
|
|
2230
|
+
nextAction: step.nextAction,
|
|
2231
|
+
recordedAt: now
|
|
2232
|
+
};
|
|
2233
|
+
record.evidenceHash = cleanText(step.evidenceHash, 120)
|
|
2234
|
+
|| (0, ai_runner_manager_policy_1.hashResolveIOAIManagerEvidence)(record);
|
|
2235
|
+
var previousRecord = bundle.aiCoderV6StepHistory[bundle.aiCoderV6StepHistory.length - 1];
|
|
2236
|
+
var managerDecision = (0, ai_runner_manager_policy_1.decideResolveIOAIManagerPolicy)({
|
|
2237
|
+
history: __spreadArray(__spreadArray([], __read(bundle.aiCoderV6StepHistory), false), [record], false),
|
|
2238
|
+
current: record,
|
|
2239
|
+
maxSameFailureRepeats: buildResolveIOAICoderV6Budget(bundle.aiCoderV6Budget).maxRepeatedNoProgress + 1
|
|
2240
|
+
});
|
|
2241
|
+
var nextLoopCount = managerDecision.loopBudgetShouldReset
|
|
2242
|
+
|| (previousRecord === null || previousRecord === void 0 ? void 0 : previousRecord.failureClass) !== record.failureClass
|
|
2243
|
+
|| (previousRecord === null || previousRecord === void 0 ? void 0 : previousRecord.blockerFingerprint) !== record.blockerFingerprint
|
|
2244
|
+
|| (previousRecord === null || previousRecord === void 0 ? void 0 : previousRecord.evidenceHash) !== record.evidenceHash
|
|
2245
|
+
? 1
|
|
2246
|
+
: bundle.aiCoderV6Budget.loopCount + 1;
|
|
2247
|
+
var budget = buildResolveIOAICoderV6Budget(bundle.aiCoderV6Budget);
|
|
2248
|
+
var shouldParkForRepeatedNoProgress = !managerDecision.loopBudgetShouldReset
|
|
2249
|
+
&& nextLoopCount > budget.maxRepeatedNoProgress
|
|
2250
|
+
&& step.outcome !== 'pass'
|
|
2251
|
+
&& step.outcome !== 'ready_to_publish'
|
|
2252
|
+
&& step.outcome !== 'published';
|
|
2253
|
+
var recordedRecoveryPlan = shouldParkForRepeatedNoProgress
|
|
2254
|
+
? (0, ai_runner_manager_policy_1.buildResolveIOAIManagerRecoveryPlan)({
|
|
2255
|
+
action: 'park_repeated_failure',
|
|
2256
|
+
reason: 'aicoder_v6_repeated_no_progress',
|
|
2257
|
+
failureClass: record.failureClass,
|
|
2258
|
+
lane: record.lane,
|
|
2259
|
+
stepType: record.stepType,
|
|
2260
|
+
blocker: record.blocker || record.summary,
|
|
2261
|
+
changedFiles: record.changedFiles,
|
|
2262
|
+
artifactPaths: record.artifactPaths,
|
|
2263
|
+
maxSameFailureRepeats: budget.maxRepeatedNoProgress + 1
|
|
2264
|
+
})
|
|
2265
|
+
: managerDecision.recoveryPlan;
|
|
2266
|
+
var recordedRecoveryCheckpoint = shouldParkForRepeatedNoProgress
|
|
2267
|
+
? (0, ai_runner_manager_policy_1.buildResolveIOAIManagerRecoveryCheckpoint)({
|
|
2268
|
+
plan: recordedRecoveryPlan,
|
|
2269
|
+
current: record
|
|
2270
|
+
})
|
|
2271
|
+
: managerDecision.recoveryCheckpoint;
|
|
2272
|
+
var recordedRecoveryEvidenceProbe = shouldParkForRepeatedNoProgress
|
|
2273
|
+
? (0, ai_runner_manager_policy_1.buildResolveIOAIManagerRecoveryEvidenceProbe)({
|
|
2274
|
+
checkpoint: recordedRecoveryCheckpoint,
|
|
2275
|
+
current: record
|
|
2276
|
+
})
|
|
2277
|
+
: managerDecision.recoveryEvidenceProbe;
|
|
2278
|
+
var recordedRecoveryAction = shouldParkForRepeatedNoProgress
|
|
2279
|
+
? (0, ai_runner_manager_policy_1.buildResolveIOAIManagerRecoveryActionPacket)({
|
|
2280
|
+
plan: recordedRecoveryPlan,
|
|
2281
|
+
checkpoint: recordedRecoveryCheckpoint,
|
|
2282
|
+
probe: recordedRecoveryEvidenceProbe,
|
|
2283
|
+
current: record
|
|
2284
|
+
})
|
|
2285
|
+
: managerDecision.recoveryAction;
|
|
2286
|
+
var previousLane = bundle.aiCoderV6LaneMemory[step.lane];
|
|
2287
|
+
var laneMemory = __assign(__assign({}, bundle.aiCoderV6LaneMemory), (_a = {}, _a[step.lane] = __assign(__assign({}, previousLane), { model: record.model || previousLane.model, threadKey: record.threadKey || previousLane.threadKey, activeStep: step.stepType, activeBlocker: record.blocker || previousLane.activeBlocker || '', activeQaRow: step.activeQaRow || previousLane.activeQaRow, changedFiles: ((_b = record.changedFiles) === null || _b === void 0 ? void 0 : _b.length) ? record.changedFiles : previousLane.changedFiles, artifactPaths: ((_c = record.artifactPaths) === null || _c === void 0 ? void 0 : _c.length) ? record.artifactPaths : previousLane.artifactPaths, latestPromptVersion: record.promptVersion || previousLane.latestPromptVersion, latestPromptTokenEstimate: promptTokens || previousLane.latestPromptTokenEstimate, updatedAt: now }), _a));
|
|
2288
|
+
var complete = step.outcome === 'published' || step.outcome === 'ready_to_publish';
|
|
2289
|
+
var parked = step.outcome === 'park_manual' || step.outcome === 'budget_stop';
|
|
2290
|
+
return __assign(__assign({}, bundle), { aiCoderV6SupervisorState: __assign(__assign({}, bundle.aiCoderV6SupervisorState), { status: complete ? 'complete' : (parked ? 'parked' : 'active'), activeLane: step.lane, activeStep: step.stepType, activeBlocker: record.blocker || '', lastGoodCheckpoint: step.outcome === 'pass' || complete ? step.stepType : bundle.aiCoderV6SupervisorState.lastGoodCheckpoint, artifactLinks: Array.from(new Set(__spreadArray(__spreadArray([], __read(bundle.aiCoderV6SupervisorState.artifactLinks), false), __read((record.artifactPaths || [])), false))).slice(-80), updatedAt: now }), aiCoderV6LaneMemory: laneMemory, aiCoderV6WorkflowMemory: {
|
|
2291
|
+
journeyContractPath: cleanText(previousWorkflowMemory.journeyContractPath || 'docs/APP_JOURNEY_CONTRACT.md', 500),
|
|
2292
|
+
primaryWorkflowId: cleanText(step.primaryWorkflowId || previousWorkflowMemory.primaryWorkflowId, 200),
|
|
2293
|
+
activeWorkflowStep: activeWorkflowStep,
|
|
2294
|
+
workflowQaRows: workflowQaRows,
|
|
2295
|
+
completedWorkflowSteps: completedWorkflowSteps,
|
|
2296
|
+
blockedWorkflowStep: blockedWorkflowStep,
|
|
2297
|
+
businessProofArtifacts: businessProofArtifacts,
|
|
2298
|
+
updatedAt: now
|
|
2299
|
+
}, aiCoderV6StepHistory: __spreadArray(__spreadArray([], __read(bundle.aiCoderV6StepHistory), false), [record], false).slice(-120), aiCoderV6Budget: __assign(__assign({}, bundle.aiCoderV6Budget), { totalPromptTokenEstimate: bundle.aiCoderV6Budget.totalPromptTokenEstimate + promptTokens, totalInputTokens: bundle.aiCoderV6Budget.totalInputTokens + inputTokens, totalCachedInputTokens: bundle.aiCoderV6Budget.totalCachedInputTokens + cachedInputTokens, totalOutputTokens: bundle.aiCoderV6Budget.totalOutputTokens + outputTokens, totalRuntimeMs: bundle.aiCoderV6Budget.totalRuntimeMs + runtimeMs, loopCount: nextLoopCount }), aiCoderV6RecoveryPlan: recordedRecoveryPlan, aiCoderV6RecoveryCheckpoint: recordedRecoveryCheckpoint, aiCoderV6RecoveryEvidenceProbe: recordedRecoveryEvidenceProbe, aiCoderV6RecoveryAction: recordedRecoveryAction });
|
|
2300
|
+
}
|
|
2301
|
+
function decideResolveIOAICoderV6Continuation(bundle) {
|
|
2302
|
+
var history = bundle.aiCoderV6StepHistory || [];
|
|
2303
|
+
var budget = buildResolveIOAICoderV6Budget(bundle.aiCoderV6Budget);
|
|
2304
|
+
var last = history[history.length - 1];
|
|
2305
|
+
var lastFingerprint = fingerprintResolveIOAICoderV6Blocker((last === null || last === void 0 ? void 0 : last.blocker) || (last === null || last === void 0 ? void 0 : last.summary) || '');
|
|
2306
|
+
var repeatedNoProgressCount = 0;
|
|
2307
|
+
for (var index = history.length - 1; index >= 0; index -= 1) {
|
|
2308
|
+
var item = history[index];
|
|
2309
|
+
if (item.outcome === 'pass' || item.outcome === 'ready_to_publish' || item.outcome === 'published') {
|
|
2310
|
+
break;
|
|
2311
|
+
}
|
|
2312
|
+
if (item.stepType !== (last === null || last === void 0 ? void 0 : last.stepType) || item.lane !== (last === null || last === void 0 ? void 0 : last.lane)) {
|
|
2313
|
+
break;
|
|
2314
|
+
}
|
|
2315
|
+
if (fingerprintResolveIOAICoderV6Blocker(item.blocker || item.summary || '') === lastFingerprint) {
|
|
2316
|
+
repeatedNoProgressCount += 1;
|
|
2317
|
+
}
|
|
2318
|
+
}
|
|
2319
|
+
var managerDecision = (0, ai_runner_manager_policy_1.decideResolveIOAIManagerPolicy)({
|
|
2320
|
+
history: history,
|
|
2321
|
+
current: last,
|
|
2322
|
+
maxSameFailureRepeats: budget.maxRepeatedNoProgress + 1,
|
|
2323
|
+
maxPingPongTransitions: 3,
|
|
2324
|
+
infraFailureClasses: ['infra', 'compile']
|
|
2325
|
+
});
|
|
2326
|
+
var recoveryPlanFor = function (action, reason, extra) {
|
|
2327
|
+
if (extra === void 0) { extra = {}; }
|
|
2328
|
+
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) || bundle.aiCoderV6SupervisorState.activeLane, stepType: (last === null || last === void 0 ? void 0 : last.stepType) || bundle.aiCoderV6SupervisorState.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 + 1 }, extra));
|
|
2329
|
+
};
|
|
2330
|
+
var recoveryCheckpointFor = function (recoveryPlan) { return (0, ai_runner_manager_policy_1.buildResolveIOAIManagerRecoveryCheckpoint)({
|
|
2331
|
+
plan: recoveryPlan,
|
|
2332
|
+
current: last
|
|
2333
|
+
}); };
|
|
2334
|
+
var recoveryFieldsFor = function (recoveryPlan, recoveryCheckpoint, recoveryEvidenceProbe) {
|
|
2335
|
+
var checkpoint = recoveryCheckpoint || recoveryCheckpointFor(recoveryPlan);
|
|
2336
|
+
var probe = recoveryEvidenceProbe || (0, ai_runner_manager_policy_1.buildResolveIOAIManagerRecoveryEvidenceProbe)({
|
|
2337
|
+
checkpoint: checkpoint,
|
|
2338
|
+
current: last
|
|
2339
|
+
});
|
|
2340
|
+
return {
|
|
2341
|
+
recoveryPlan: recoveryPlan,
|
|
2342
|
+
recoveryCheckpoint: checkpoint,
|
|
2343
|
+
recoveryEvidenceProbe: probe,
|
|
2344
|
+
recoveryAction: (0, ai_runner_manager_policy_1.buildResolveIOAIManagerRecoveryActionPacket)({
|
|
2345
|
+
plan: recoveryPlan,
|
|
2346
|
+
checkpoint: checkpoint,
|
|
2347
|
+
probe: probe,
|
|
2348
|
+
current: last
|
|
2349
|
+
})
|
|
2350
|
+
};
|
|
2351
|
+
};
|
|
2352
|
+
var managerRecoveryFields = function () { return recoveryFieldsFor(managerDecision.recoveryPlan, managerDecision.recoveryCheckpoint, managerDecision.recoveryEvidenceProbe); };
|
|
2353
|
+
var withWorkflowReadiness = function (decision) {
|
|
2354
|
+
var workflowReadiness = buildResolveIOAICoderV6WorkflowReadiness(bundle, {
|
|
2355
|
+
action: decision.action,
|
|
2356
|
+
reason: decision.reason,
|
|
2357
|
+
nextLane: decision.nextLane,
|
|
2358
|
+
nextStep: decision.nextStep,
|
|
2359
|
+
budgetExceeded: decision.budgetExceeded,
|
|
2360
|
+
repeatedNoProgressCount: decision.repeatedNoProgressCount
|
|
2361
|
+
});
|
|
2362
|
+
var workflowProofCheckpoint = workflowReadiness.workflowProofCheckpoint;
|
|
2363
|
+
return __assign(__assign({}, decision), { workflowReadiness: workflowReadiness, workflowProofCheckpoint: workflowProofCheckpoint, nextActionContract: buildResolveIOAICoderNextActionContract({
|
|
2364
|
+
bundle: bundle,
|
|
2365
|
+
action: decision.action,
|
|
2366
|
+
reason: decision.reason,
|
|
2367
|
+
nextLane: decision.nextLane,
|
|
2368
|
+
nextStep: decision.nextStep,
|
|
2369
|
+
budgetExceeded: decision.budgetExceeded,
|
|
2370
|
+
workflowReadiness: workflowReadiness,
|
|
2371
|
+
workflowProofCheckpoint: workflowProofCheckpoint
|
|
2372
|
+
}) });
|
|
2373
|
+
};
|
|
2374
|
+
var budgetExceeded = (budget.loopCount >= budget.maxLoopsPerRun && !managerDecision.loopBudgetShouldReset)
|
|
2375
|
+
|| budget.totalPromptTokenEstimate >= budget.maxTotalPromptTokens
|
|
2376
|
+
|| ((last === null || last === void 0 ? void 0 : last.promptTokenEstimate) || 0) > budget.maxPromptTokensPerNonInitialStep * 2;
|
|
2377
|
+
if (budgetExceeded) {
|
|
2378
|
+
var recoveryPlan_1 = recoveryPlanFor('budget_stop', 'aicoder_v6_budget_guard', {
|
|
2379
|
+
productRepairFailure: false
|
|
2380
|
+
});
|
|
2381
|
+
return withWorkflowReadiness(__assign({ action: 'budget_stop', reason: 'aicoder_v6_budget_guard', nextLane: (last === null || last === void 0 ? void 0 : last.lane) || bundle.aiCoderV6SupervisorState.activeLane, nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || bundle.aiCoderV6SupervisorState.activeStep, repeatedNoProgressCount: repeatedNoProgressCount, budgetExceeded: budgetExceeded }, recoveryFieldsFor(recoveryPlan_1)));
|
|
2382
|
+
}
|
|
2383
|
+
if (managerDecision.action === 'park_ping_pong') {
|
|
2384
|
+
return withWorkflowReadiness(__assign({ action: 'park', reason: 'aicoder_v6_ping_pong_no_progress', nextLane: (last === null || last === void 0 ? void 0 : last.lane) || bundle.aiCoderV6SupervisorState.activeLane, nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || bundle.aiCoderV6SupervisorState.activeStep, repeatedNoProgressCount: managerDecision.pingPongCount, budgetExceeded: false }, managerRecoveryFields()));
|
|
2385
|
+
}
|
|
2386
|
+
if (managerDecision.action === 'park_repeated_failure') {
|
|
2387
|
+
return withWorkflowReadiness(__assign({ action: 'park', reason: 'aicoder_v6_repeated_no_progress', nextLane: (last === null || last === void 0 ? void 0 : last.lane) || bundle.aiCoderV6SupervisorState.activeLane, nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || bundle.aiCoderV6SupervisorState.activeStep, repeatedNoProgressCount: managerDecision.sameFailureCount, budgetExceeded: false }, managerRecoveryFields()));
|
|
2388
|
+
}
|
|
2389
|
+
if (repeatedNoProgressCount > budget.maxRepeatedNoProgress) {
|
|
2390
|
+
var recoveryPlan_2 = recoveryPlanFor('park', 'aicoder_v6_repeated_no_progress', {
|
|
2391
|
+
action: 'park_repeated_failure',
|
|
2392
|
+
productRepairFailure: !/^(?:infra|compile|release)$/i.test(String((last === null || last === void 0 ? void 0 : last.failureClass) || ''))
|
|
2393
|
+
});
|
|
2394
|
+
return withWorkflowReadiness(__assign({ action: 'park', reason: 'aicoder_v6_repeated_no_progress', nextLane: (last === null || last === void 0 ? void 0 : last.lane) || bundle.aiCoderV6SupervisorState.activeLane, nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || bundle.aiCoderV6SupervisorState.activeStep, repeatedNoProgressCount: repeatedNoProgressCount, budgetExceeded: false }, recoveryFieldsFor(recoveryPlan_2)));
|
|
2395
|
+
}
|
|
2396
|
+
if (managerDecision.action === 'retry_infra') {
|
|
2397
|
+
var compileRepair = managerDecision.recoveryPlan.recoveryClass === 'compile_repair'
|
|
2398
|
+
|| managerDecision.failureClass === 'compile'
|
|
2399
|
+
|| (last === null || last === void 0 ? void 0 : last.failureClass) === 'compile';
|
|
2400
|
+
return withWorkflowReadiness(__assign({ action: 'infra_retry', reason: compileRepair ? 'aicoder_v6_compile_repair_required' : 'aicoder_v6_infra_retry', nextLane: (last === null || last === void 0 ? void 0 : last.lane) || bundle.aiCoderV6SupervisorState.activeLane, nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || bundle.aiCoderV6SupervisorState.activeStep, repeatedNoProgressCount: repeatedNoProgressCount, budgetExceeded: false }, managerRecoveryFields()));
|
|
2401
|
+
}
|
|
2402
|
+
if ((last === null || last === void 0 ? void 0 : last.outcome) === 'needs_repair') {
|
|
2403
|
+
if (last.failureClass === 'journey') {
|
|
2404
|
+
return withWorkflowReadiness(__assign({ action: 'retry_same_step', reason: 'aicoder_v6_journey_contract_repair_required', nextLane: 'plan', nextStep: last.stepType === 'journey_validation' ? 'journey_contract' : last.stepType, repeatedNoProgressCount: repeatedNoProgressCount, budgetExceeded: false }, managerRecoveryFields()));
|
|
2405
|
+
}
|
|
2406
|
+
if (last.failureClass === 'release') {
|
|
2407
|
+
return withWorkflowReadiness(__assign({ action: 'retry_same_step', reason: 'aicoder_v6_release_repair_required', nextLane: 'publish', nextStep: last.stepType, repeatedNoProgressCount: repeatedNoProgressCount, budgetExceeded: false }, managerRecoveryFields()));
|
|
2408
|
+
}
|
|
2409
|
+
return withWorkflowReadiness(__assign({ action: last.lane === 'repair' ? 'retry_same_step' : 'switch_to_repair', reason: 'aicoder_v6_repair_required', nextLane: 'repair', nextStep: 'repair', repeatedNoProgressCount: repeatedNoProgressCount, budgetExceeded: false }, managerRecoveryFields()));
|
|
2410
|
+
}
|
|
2411
|
+
if ((last === null || last === void 0 ? void 0 : last.outcome) === 'infra_retry') {
|
|
2412
|
+
var recoveryPlan_3 = recoveryPlanFor('infra_retry', 'aicoder_v6_infra_retry', {
|
|
2413
|
+
failureClass: 'infra',
|
|
2414
|
+
productRepairFailure: false
|
|
2415
|
+
});
|
|
2416
|
+
return withWorkflowReadiness(__assign({ action: 'infra_retry', reason: 'aicoder_v6_infra_retry', nextLane: last.lane, nextStep: last.stepType, repeatedNoProgressCount: repeatedNoProgressCount, budgetExceeded: false }, recoveryFieldsFor(recoveryPlan_3)));
|
|
2417
|
+
}
|
|
2418
|
+
if ((last === null || last === void 0 ? void 0 : last.outcome) === 'ready_to_publish') {
|
|
2419
|
+
var recoveryPlan_4 = recoveryPlanFor('ready_to_publish', 'aicoder_v6_ready_to_publish', {
|
|
2420
|
+
failureClass: 'release',
|
|
2421
|
+
productRepairFailure: false
|
|
2422
|
+
});
|
|
2423
|
+
return withWorkflowReadiness(__assign({ action: 'ready_to_publish', reason: 'aicoder_v6_ready_to_publish', nextLane: 'publish', nextStep: 'publish', repeatedNoProgressCount: repeatedNoProgressCount, budgetExceeded: false }, recoveryFieldsFor(recoveryPlan_4)));
|
|
2424
|
+
}
|
|
2425
|
+
var recoveryPlan = managerDecision.recoveryPlan || recoveryPlanFor('continue', 'aicoder_v6_continue');
|
|
2426
|
+
var fallbackCheckpoint = managerDecision.recoveryCheckpoint || recoveryCheckpointFor(recoveryPlan);
|
|
2427
|
+
return withWorkflowReadiness(__assign({ action: 'continue', reason: 'aicoder_v6_continue', nextLane: (last === null || last === void 0 ? void 0 : last.lane) || bundle.aiCoderV6SupervisorState.activeLane, nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || bundle.aiCoderV6SupervisorState.activeStep, repeatedNoProgressCount: repeatedNoProgressCount, budgetExceeded: false }, recoveryFieldsFor(recoveryPlan, fallbackCheckpoint, managerDecision.recoveryEvidenceProbe)));
|
|
2428
|
+
}
|
|
2429
|
+
function buildResolveIOAICoderV6DiagnoseFirstPrompt(lines) {
|
|
2430
|
+
var _a, _b;
|
|
2431
|
+
return [
|
|
2432
|
+
'AICoder Runner V6 contract: use compact lane memory, diagnose first, then make the smallest proven next move.',
|
|
2433
|
+
'Start with Diagnose First: observed evidence, likely cause, smallest next action, and expected proof.',
|
|
2434
|
+
'Use current artifacts, changed files, and lane memory before asking for broad context.',
|
|
2435
|
+
'Do not spawn duplicate build, QA, browser, server, Mongo, or Codex processes.',
|
|
2436
|
+
'If repairing, inspect logs/artifacts/source/diff first; retest the failed check before advancing.',
|
|
2437
|
+
'If the same blocker repeats without new proof, park with the exact blocker instead of burning more tokens.',
|
|
2438
|
+
lines.goal ? "Goal: ".concat(cleanText(lines.goal, 500)) : '',
|
|
2439
|
+
cleanList(lines.approvedScope, 12, 240).length ? "Approved scope: ".concat(cleanList(lines.approvedScope, 12, 240).join(' | ')) : '',
|
|
2440
|
+
lines.activeLane ? "Active lane: ".concat(lines.activeLane) : '',
|
|
2441
|
+
lines.activeStep ? "Active step: ".concat(lines.activeStep) : '',
|
|
2442
|
+
lines.laneSummary ? "Lane memory: ".concat(cleanText(lines.laneSummary, 700)) : '',
|
|
2443
|
+
lines.activeBlocker ? "Active blocker: ".concat(cleanText(lines.activeBlocker, 800)) : '',
|
|
2444
|
+
((_a = lines.currentQaRow) === null || _a === void 0 ? void 0 : _a.workflow) ? "Current QA row: ".concat(cleanText(lines.currentQaRow.workflow, 300)) : '',
|
|
2445
|
+
((_b = lines.currentQaRow) === null || _b === void 0 ? void 0 : _b.route) ? "Current QA route: ".concat(cleanText(lines.currentQaRow.route, 300)) : '',
|
|
2446
|
+
lines.journeyContractPath ? "Journey contract: ".concat(cleanText(lines.journeyContractPath, 240)) : '',
|
|
2447
|
+
lines.activeWorkflowStep ? "Active workflow step: ".concat(cleanText(lines.activeWorkflowStep, 240)) : '',
|
|
2448
|
+
cleanList(lines.changedFiles, 12, 200).length ? "Changed files: ".concat(cleanList(lines.changedFiles, 12, 200).join(', ')) : '',
|
|
2449
|
+
cleanList(lines.artifactPaths, 12, 240).length ? "Artifacts: ".concat(cleanList(lines.artifactPaths, 12, 240).join(', ')) : ''
|
|
2450
|
+
].filter(Boolean);
|
|
2451
|
+
}
|
|
2452
|
+
function buildResolveIOAICoderV6Incident(input) {
|
|
2453
|
+
return {
|
|
2454
|
+
incidentClass: cleanText(input.incidentClass, 120) || 'aicoder_v6_runner_incident',
|
|
2455
|
+
summary: cleanText(input.summary, 1200),
|
|
2456
|
+
stepType: input.stepType,
|
|
2457
|
+
lane: input.lane,
|
|
2458
|
+
blockerFingerprint: input.blocker ? fingerprintResolveIOAICoderV6Blocker(input.blocker) : undefined,
|
|
2459
|
+
artifactPaths: cleanList(input.artifactPaths, 40, 500),
|
|
2460
|
+
recordedAt: isoNow(input.now)
|
|
2461
|
+
};
|
|
2462
|
+
}
|
|
2463
|
+
|
|
2464
|
+
//# sourceMappingURL=aicoder-runner-v6.js.map
|