@resolveio/server-lib 22.3.125 → 22.3.126
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.nodemon.json +5 -0
- package/.vscode/settings.json +21 -0
- package/AGENTS.md +195 -0
- package/README.md +22 -0
- package/build_package.sh +5 -0
- package/compileDTS.pl +64 -0
- package/docs/ai-assistant-nightly-eval.md +65 -0
- package/docs/ai-assistant-preflight-checklist.md +23 -0
- package/docs/ai-assistant-report-builder-bridge-playbook.md +115 -0
- package/eslint-plugin-custom/index.js +7 -0
- package/eslint-plugin-custom/rules/no-filter-zero-index.js +44 -0
- package/eslint.config.js +103 -0
- package/gulpfile.js +216 -0
- package/methodAndPublicationListGenerator.py +375 -0
- package/mongodbensurers.js +2 -0
- package/mongostop.js +3 -0
- package/package.json +1 -1
- package/scripts/cleanup-bypassed-callmethod-logs.js +616 -0
- package/settings.development.json +25 -0
- package/settings.development.redacted.json +25 -0
- package/src/.env +12 -0
- package/src/ai/assistant-core-heuristics.ts +379 -0
- package/src/ai/resolveio-platform-intelligence-memory-corpus.ts +185 -0
- package/src/ai/resolveio-platform-intelligence-memory.ts +325 -0
- package/{ai/resolveio-platform-intelligence-types.d.ts → src/ai/resolveio-platform-intelligence-types.ts} +20 -15
- package/src/ai/resolveio-platform-intelligence.ts +462 -0
- package/src/client-server-app.ts +12 -0
- package/src/collections/ai-run.collection.ts +117 -0
- package/src/collections/ai-terminal-conversation.collection.ts +91 -0
- package/src/collections/ai-terminal-issue-report.collection.ts +99 -0
- package/src/collections/ai-terminal-message.collection.ts +77 -0
- package/src/collections/app-setting.collection.ts +104 -0
- package/src/collections/app-status.collection.ts +58 -0
- package/src/collections/communication-metric.collection.ts +84 -0
- package/src/collections/counter.collection.ts +56 -0
- package/src/collections/cron-job-history.collection.ts +94 -0
- package/src/collections/cron-job.collection.ts +92 -0
- package/src/collections/customer-notification.collection.ts +131 -0
- package/src/collections/customer-portal-password.collection.ts +76 -0
- package/src/collections/email-history.collection.ts +134 -0
- package/src/collections/email-verified.collection.ts +62 -0
- package/src/collections/file.collection.ts +74 -0
- package/src/collections/flag-update.collection.ts +57 -0
- package/src/collections/flag.collection.ts +57 -0
- package/src/collections/log-method-latency.collection.ts +77 -0
- package/src/collections/log-subscription.collection.ts +80 -0
- package/src/collections/log.collection.ts +93 -0
- package/src/collections/logged-in-users.collection.ts +67 -0
- package/src/collections/monitor-cpu.collection.ts +65 -0
- package/src/collections/monitor-function.collection.ts +74 -0
- package/src/collections/monitor-memory.collection.ts +77 -0
- package/src/collections/monitor-mongo.collection.ts +71 -0
- package/src/collections/notification.collection.ts +57 -0
- package/src/collections/openai-usage-ledger.collection.ts +77 -0
- package/src/collections/report-builder-dashboard-builder.collection.ts +109 -0
- package/src/collections/report-builder-library.collection.ts +89 -0
- package/src/collections/report-builder-report.collection.ts +184 -0
- package/src/collections/user-group.collection.ts +89 -0
- package/src/collections/user-guide.collection.ts +57 -0
- package/src/collections/user.collection.ts +181 -0
- package/src/cron/cron.ts +117 -0
- package/src/fixtures/cron-jobs.ts +95 -0
- package/src/fixtures/init.ts +35 -0
- package/src/http/auth.ts +818 -0
- package/src/http/health.ts +7 -0
- package/src/http/home.ts +90 -0
- package/src/http/slow-query-publication.ts +49 -0
- package/src/index.ts +1 -0
- package/src/managers/ai-assistant-codex-manager.manager.ts +1131 -0
- package/src/managers/ai-run-evidence.manager.ts +264 -0
- package/src/managers/communication-metric.manager.ts +82 -0
- package/src/managers/cron.manager.ts +333 -0
- package/src/managers/customer-notification-content.manager.ts +236 -0
- package/src/managers/diagnostic-manager-bootstrap.ts +165 -0
- package/src/managers/error-auto-fix.manager.ts +2767 -0
- package/src/managers/local-log.manager.ts +113 -0
- package/src/managers/method.manager.ts +1857 -0
- package/src/managers/mongo.manager.ts +4575 -0
- package/src/managers/monitor.manager.ts +507 -0
- package/src/managers/openai-usage-ledger.manager.ts +57 -0
- package/src/managers/slow-query-verifier.manager.ts +3590 -0
- package/src/managers/slow-query.manager.ts +519 -0
- package/src/managers/subscription.manager.ts +3128 -0
- package/src/managers/websocket.manager.ts +746 -0
- package/src/managers/worker-dispatcher.manager.ts +1360 -0
- package/src/managers/worker-server.manager.ts +536 -0
- package/src/methods/accounts.ts +532 -0
- package/src/methods/ai-terminal.ts +23497 -0
- package/src/methods/app-settings.ts +114 -0
- package/src/methods/aws.ts +649 -0
- package/src/methods/collections.ts +641 -0
- package/src/methods/counters.ts +69 -0
- package/src/methods/cron-jobs.ts +2614 -0
- package/src/methods/customer-notifications.ts +458 -0
- package/src/methods/diagnostics.ts +616 -0
- package/src/methods/flag-updates.ts +7 -0
- package/src/methods/flags.ts +7 -0
- package/src/methods/logs.ts +657 -0
- package/src/methods/mongo-explorer.ts +1880 -0
- package/src/methods/monitor.ts +540 -0
- package/src/methods/pdf.ts +1236 -0
- package/src/methods/publications.ts +129 -0
- package/src/methods/report-builder.ts +3300 -0
- package/src/methods/support.ts +335 -0
- package/src/models/ai-run.model.ts +27 -0
- package/src/models/ai-terminal-conversation.model.ts +19 -0
- package/src/models/ai-terminal-issue-report.model.ts +21 -0
- package/src/models/ai-terminal-message.model.ts +24 -0
- package/src/models/app-setting.model.ts +17 -0
- package/{models/app-status.model.d.ts → src/models/app-status.model.ts} +3 -2
- package/{models/billing-logged-in-users.model.d.ts → src/models/billing-logged-in-users.model.ts} +5 -4
- package/src/models/collection-document.model.ts +24 -0
- package/src/models/communication-metric.model.ts +23 -0
- package/{models/counter.model.d.ts → src/models/counter.model.ts} +4 -3
- package/src/models/cron-job-history.model.ts +16 -0
- package/src/models/cron-job.model.ts +15 -0
- package/src/models/customer-notification.model.ts +28 -0
- package/src/models/customer-portal-password.model.ts +12 -0
- package/src/models/dialog.model.ts +25 -0
- package/{models/email-history.model.js → src/models/email-history.model.ts} +36 -4
- package/{models/email-verified.model.d.ts → src/models/email-verified.model.ts} +6 -5
- package/{models/file.model.d.ts → src/models/file.model.ts} +8 -7
- package/{models/flag-update.model.d.ts → src/models/flag-update.model.ts} +4 -3
- package/{models/flag.model.d.ts → src/models/flag.model.ts} +4 -3
- package/src/models/log-method-latency.model.ts +11 -0
- package/{models/log-subscription.model.d.ts → src/models/log-subscription.model.ts} +11 -9
- package/src/models/log.model.ts +19 -0
- package/{models/logged-in-users.model.d.ts → src/models/logged-in-users.model.ts} +6 -5
- package/{models/method-response.model.d.ts → src/models/method-response.model.ts} +7 -6
- package/src/models/method.model.ts +25 -0
- package/{models/monitor-cpu.model.d.ts → src/models/monitor-cpu.model.ts} +9 -7
- package/src/models/monitor-function.model.ts +16 -0
- package/src/models/monitor-memory.model.ts +17 -0
- package/src/models/monitor-mongo.model.ts +15 -0
- package/{models/notification.model.d.ts → src/models/notification.model.ts} +6 -4
- package/src/models/openai-usage-ledger.model.ts +16 -0
- package/src/models/pagination.model.ts +35 -0
- package/src/models/permission.model.ts +14 -0
- package/src/models/report-builder-dashboard-builder.model.ts +29 -0
- package/src/models/report-builder-library.model.ts +20 -0
- package/src/models/report-builder-report.model.ts +136 -0
- package/src/models/report-builder.model.ts +68 -0
- package/src/models/select-data-label.model.ts +9 -0
- package/src/models/server-message.model.ts +31 -0
- package/src/models/slow-query-report.model.ts +23 -0
- package/src/models/subscription.model.ts +73 -0
- package/src/models/support-ticket.model.ts +104 -0
- package/src/models/user-group.model.ts +24 -0
- package/{models/user-guide.model.d.ts → src/models/user-guide.model.ts} +5 -4
- package/src/models/user.model.ts +96 -0
- package/src/private/images/ResolveIO.png +0 -0
- package/src/publications/ai-terminal.ts +73 -0
- package/src/publications/app-settings.ts +25 -0
- package/src/publications/app-status.ts +13 -0
- package/src/publications/cron-jobs.ts +40 -0
- package/src/publications/customer-notifications.ts +101 -0
- package/src/publications/files.ts +33 -0
- package/src/publications/flags-update.ts +19 -0
- package/src/publications/flags.ts +19 -0
- package/src/publications/logs.ts +163 -0
- package/src/publications/notifications.ts +13 -0
- package/src/publications/report-builder-dashboard-builders.ts +39 -0
- package/src/publications/report-builder-libraries.ts +41 -0
- package/src/publications/report-builder-reports.ts +47 -0
- package/src/publications/super-admin.ts +13 -0
- package/src/publications/user-groups.ts +12 -0
- package/src/publications/user-guides.ts +12 -0
- package/src/resolveio-server-app.ts +617 -0
- package/src/server-app.ts +3354 -0
- package/src/services/codex-client.ts +1231 -0
- package/src/services/openai-client.ts +265 -0
- package/src/types/error-report.ts +26 -0
- package/src/types/js-tiktoken.d.ts +11 -0
- package/src/types/slow-query-report.ts +28 -0
- package/src/util/ai-qa-policy.ts +925 -0
- package/src/util/ai-run-evidence-adapters.ts +521 -0
- package/src/util/ai-run-evidence-dashboard.ts +271 -0
- package/src/util/ai-run-evidence-eval.ts +885 -0
- package/src/util/ai-run-evidence.ts +964 -0
- package/src/util/ai-runner-artifacts.ts +586 -0
- package/src/util/ai-runner-qa-auth.ts +821 -0
- package/src/util/ai-runner-qa-tools.ts +3045 -0
- package/src/util/aicoder-runner-v6.ts +526 -0
- package/src/util/common.ts +649 -0
- package/src/util/customer-portal-password.ts +183 -0
- package/src/util/error-reporter.ts +332 -0
- package/src/util/error-tracking.ts +79 -0
- package/src/util/openai-usage-cost.ts +114 -0
- package/src/util/report-builder-unwinds.ts +180 -0
- package/src/util/runner-process-janitor.ts +219 -0
- package/src/util/schema-report-builder.ts +448 -0
- package/src/util/slow-query-reporter.ts +216 -0
- package/src/util/subscription-dependency-context.ts +1096 -0
- package/src/util/support-runner-v5.ts +897 -0
- package/src/util/tokenizer.ts +38 -0
- package/src/workers/codex-runner.worker.ts +142 -0
- package/start_server.sh +5 -0
- package/tests/ai-assistant-corpus-build.ts +484 -0
- package/tests/ai-assistant-corpus-replay-e2e.ts +774 -0
- package/tests/ai-assistant-data-parity-e2e.ts +1989 -0
- package/tests/ai-assistant-eval-triage.ts +831 -0
- package/tests/ai-assistant-openai-e2e.ts +1061 -0
- package/tests/ai-assistant-openai-git-e2e.ts +155 -0
- package/tests/ai-assistant-preflight-matrix.ts +215 -0
- package/tests/ai-assistant-routing-eval.test.ts +560 -0
- package/tests/ai-assistant-snf-live-eval.ts +975 -0
- package/tests/ai-assistant-utils.test.ts +2968 -0
- package/tests/ai-run-eval.test.ts +88 -0
- package/tests/ai-run-evidence.test.ts +232 -0
- package/tests/ai-runner-contract.test.ts +488 -0
- package/tests/aicoder-runner-v6.test.ts +92 -0
- package/tests/error-reporter.test.ts +145 -0
- package/tests/method-publication-generator.test.ts +46 -0
- package/tests/report-builder-linking.test.ts +79 -0
- package/tests/resolveio-platform-intelligence.test.ts +352 -0
- package/tests/server-app-cron-owner.test.ts +127 -0
- package/tests/subscription-connect-race.test.ts +158 -0
- package/tests/subscription-dependency-context.test.ts +324 -0
- package/tests/subscription-manager-collection-tracking.test.ts +86 -0
- package/tests/subscription-manager-invalidation.test.ts +86 -0
- package/tests/support-runner-v5.test.ts +191 -0
- package/tsconfig.json +34 -0
- package/ai/assistant-core-heuristics.d.ts +0 -11
- package/ai/assistant-core-heuristics.js +0 -356
- package/ai/assistant-core-heuristics.js.map +0 -1
- package/ai/resolveio-platform-intelligence-memory-corpus.d.ts +0 -3
- package/ai/resolveio-platform-intelligence-memory-corpus.js +0 -214
- package/ai/resolveio-platform-intelligence-memory-corpus.js.map +0 -1
- package/ai/resolveio-platform-intelligence-memory.d.ts +0 -20
- package/ai/resolveio-platform-intelligence-memory.js +0 -341
- package/ai/resolveio-platform-intelligence-memory.js.map +0 -1
- package/ai/resolveio-platform-intelligence-types.js +0 -4
- package/ai/resolveio-platform-intelligence-types.js.map +0 -1
- package/ai/resolveio-platform-intelligence.d.ts +0 -6
- package/ai/resolveio-platform-intelligence.js +0 -463
- package/ai/resolveio-platform-intelligence.js.map +0 -1
- package/client-server-app.d.ts +0 -1
- package/client-server-app.js +0 -68
- package/client-server-app.js.map +0 -1
- package/collections/ai-run.collection.d.ts +0 -3
- package/collections/ai-run.collection.js +0 -170
- package/collections/ai-run.collection.js.map +0 -1
- package/collections/ai-terminal-conversation.collection.d.ts +0 -2
- package/collections/ai-terminal-conversation.collection.js +0 -140
- package/collections/ai-terminal-conversation.collection.js.map +0 -1
- package/collections/ai-terminal-issue-report.collection.d.ts +0 -2
- package/collections/ai-terminal-issue-report.collection.js +0 -148
- package/collections/ai-terminal-issue-report.collection.js.map +0 -1
- package/collections/ai-terminal-message.collection.d.ts +0 -2
- package/collections/ai-terminal-message.collection.js +0 -121
- package/collections/ai-terminal-message.collection.js.map +0 -1
- package/collections/app-setting.collection.d.ts +0 -3
- package/collections/app-setting.collection.js +0 -103
- package/collections/app-setting.collection.js.map +0 -1
- package/collections/app-status.collection.d.ts +0 -3
- package/collections/app-status.collection.js +0 -57
- package/collections/app-status.collection.js.map +0 -1
- package/collections/communication-metric.collection.d.ts +0 -2
- package/collections/communication-metric.collection.js +0 -133
- package/collections/communication-metric.collection.js.map +0 -1
- package/collections/counter.collection.d.ts +0 -3
- package/collections/counter.collection.js +0 -56
- package/collections/counter.collection.js.map +0 -1
- package/collections/cron-job-history.collection.d.ts +0 -3
- package/collections/cron-job-history.collection.js +0 -137
- package/collections/cron-job-history.collection.js.map +0 -1
- package/collections/cron-job.collection.d.ts +0 -3
- package/collections/cron-job.collection.js +0 -92
- package/collections/cron-job.collection.js.map +0 -1
- package/collections/customer-notification.collection.d.ts +0 -3
- package/collections/customer-notification.collection.js +0 -130
- package/collections/customer-notification.collection.js.map +0 -1
- package/collections/customer-portal-password.collection.d.ts +0 -3
- package/collections/customer-portal-password.collection.js +0 -75
- package/collections/customer-portal-password.collection.js.map +0 -1
- package/collections/email-history.collection.d.ts +0 -3
- package/collections/email-history.collection.js +0 -134
- package/collections/email-history.collection.js.map +0 -1
- package/collections/email-verified.collection.d.ts +0 -3
- package/collections/email-verified.collection.js +0 -62
- package/collections/email-verified.collection.js.map +0 -1
- package/collections/file.collection.d.ts +0 -3
- package/collections/file.collection.js +0 -74
- package/collections/file.collection.js.map +0 -1
- package/collections/flag-update.collection.d.ts +0 -3
- package/collections/flag-update.collection.js +0 -57
- package/collections/flag-update.collection.js.map +0 -1
- package/collections/flag.collection.d.ts +0 -3
- package/collections/flag.collection.js +0 -57
- package/collections/flag.collection.js.map +0 -1
- package/collections/log-method-latency.collection.d.ts +0 -3
- package/collections/log-method-latency.collection.js +0 -77
- package/collections/log-method-latency.collection.js.map +0 -1
- package/collections/log-subscription.collection.d.ts +0 -3
- package/collections/log-subscription.collection.js +0 -80
- package/collections/log-subscription.collection.js.map +0 -1
- package/collections/log.collection.d.ts +0 -3
- package/collections/log.collection.js +0 -93
- package/collections/log.collection.js.map +0 -1
- package/collections/logged-in-users.collection.d.ts +0 -3
- package/collections/logged-in-users.collection.js +0 -67
- package/collections/logged-in-users.collection.js.map +0 -1
- package/collections/monitor-cpu.collection.d.ts +0 -3
- package/collections/monitor-cpu.collection.js +0 -65
- package/collections/monitor-cpu.collection.js.map +0 -1
- package/collections/monitor-function.collection.d.ts +0 -3
- package/collections/monitor-function.collection.js +0 -74
- package/collections/monitor-function.collection.js.map +0 -1
- package/collections/monitor-memory.collection.d.ts +0 -3
- package/collections/monitor-memory.collection.js +0 -77
- package/collections/monitor-memory.collection.js.map +0 -1
- package/collections/monitor-mongo.collection.d.ts +0 -3
- package/collections/monitor-mongo.collection.js +0 -71
- package/collections/monitor-mongo.collection.js.map +0 -1
- package/collections/notification.collection.d.ts +0 -3
- package/collections/notification.collection.js +0 -57
- package/collections/notification.collection.js.map +0 -1
- package/collections/openai-usage-ledger.collection.d.ts +0 -2
- package/collections/openai-usage-ledger.collection.js +0 -124
- package/collections/openai-usage-ledger.collection.js.map +0 -1
- package/collections/report-builder-dashboard-builder.collection.d.ts +0 -3
- package/collections/report-builder-dashboard-builder.collection.js +0 -109
- package/collections/report-builder-dashboard-builder.collection.js.map +0 -1
- package/collections/report-builder-library.collection.d.ts +0 -3
- package/collections/report-builder-library.collection.js +0 -87
- package/collections/report-builder-library.collection.js.map +0 -1
- package/collections/report-builder-report.collection.d.ts +0 -4
- package/collections/report-builder-report.collection.js +0 -184
- package/collections/report-builder-report.collection.js.map +0 -1
- package/collections/user-group.collection.d.ts +0 -4
- package/collections/user-group.collection.js +0 -89
- package/collections/user-group.collection.js.map +0 -1
- package/collections/user-guide.collection.d.ts +0 -3
- package/collections/user-guide.collection.js +0 -57
- package/collections/user-guide.collection.js.map +0 -1
- package/collections/user.collection.d.ts +0 -4
- package/collections/user.collection.js +0 -180
- package/collections/user.collection.js.map +0 -1
- package/cron/cron.d.ts +0 -14
- package/cron/cron.js +0 -216
- package/cron/cron.js.map +0 -1
- package/fixtures/cron-jobs.d.ts +0 -1
- package/fixtures/cron-jobs.js +0 -150
- package/fixtures/cron-jobs.js.map +0 -1
- package/fixtures/init.d.ts +0 -1
- package/fixtures/init.js +0 -91
- package/fixtures/init.js.map +0 -1
- package/http/auth.d.ts +0 -2
- package/http/auth.js +0 -951
- package/http/auth.js.map +0 -1
- package/http/health.d.ts +0 -1
- package/http/health.js +0 -11
- package/http/health.js.map +0 -1
- package/http/home.d.ts +0 -1
- package/http/home.js +0 -134
- package/http/home.js.map +0 -1
- package/http/slow-query-publication.d.ts +0 -2
- package/http/slow-query-publication.js +0 -99
- package/http/slow-query-publication.js.map +0 -1
- package/index.d.ts +0 -1
- package/index.js +0 -19
- package/index.js.map +0 -1
- package/managers/ai-assistant-codex-manager.manager.d.ts +0 -67
- package/managers/ai-assistant-codex-manager.manager.js +0 -1113
- package/managers/ai-assistant-codex-manager.manager.js.map +0 -1
- package/managers/ai-run-evidence.manager.d.ts +0 -36
- package/managers/ai-run-evidence.manager.js +0 -377
- package/managers/ai-run-evidence.manager.js.map +0 -1
- package/managers/communication-metric.manager.d.ts +0 -16
- package/managers/communication-metric.manager.js +0 -134
- package/managers/communication-metric.manager.js.map +0 -1
- package/managers/cron.manager.d.ts +0 -20
- package/managers/cron.manager.js +0 -534
- package/managers/cron.manager.js.map +0 -1
- package/managers/customer-notification-content.manager.d.ts +0 -55
- package/managers/customer-notification-content.manager.js +0 -158
- package/managers/customer-notification-content.manager.js.map +0 -1
- package/managers/diagnostic-manager-bootstrap.d.ts +0 -9
- package/managers/diagnostic-manager-bootstrap.js +0 -260
- package/managers/diagnostic-manager-bootstrap.js.map +0 -1
- package/managers/error-auto-fix.manager.d.ts +0 -149
- package/managers/error-auto-fix.manager.js +0 -3064
- package/managers/error-auto-fix.manager.js.map +0 -1
- package/managers/local-log.manager.d.ts +0 -18
- package/managers/local-log.manager.js +0 -88
- package/managers/local-log.manager.js.map +0 -1
- package/managers/method.manager.d.ts +0 -84
- package/managers/method.manager.js +0 -1964
- package/managers/method.manager.js.map +0 -1
- package/managers/mongo.manager.d.ts +0 -224
- package/managers/mongo.manager.js +0 -5000
- package/managers/mongo.manager.js.map +0 -1
- package/managers/monitor.manager.d.ts +0 -70
- package/managers/monitor.manager.js +0 -550
- package/managers/monitor.manager.js.map +0 -1
- package/managers/openai-usage-ledger.manager.d.ts +0 -16
- package/managers/openai-usage-ledger.manager.js +0 -93
- package/managers/openai-usage-ledger.manager.js.map +0 -1
- package/managers/slow-query-verifier.manager.d.ts +0 -144
- package/managers/slow-query-verifier.manager.js +0 -3857
- package/managers/slow-query-verifier.manager.js.map +0 -1
- package/managers/slow-query.manager.d.ts +0 -28
- package/managers/slow-query.manager.js +0 -468
- package/managers/slow-query.manager.js.map +0 -1
- package/managers/subscription.manager.d.ts +0 -169
- package/managers/subscription.manager.js +0 -3434
- package/managers/subscription.manager.js.map +0 -1
- package/managers/websocket.manager.d.ts +0 -73
- package/managers/websocket.manager.js +0 -673
- package/managers/websocket.manager.js.map +0 -1
- package/managers/worker-dispatcher.manager.d.ts +0 -120
- package/managers/worker-dispatcher.manager.js +0 -1266
- package/managers/worker-dispatcher.manager.js.map +0 -1
- package/managers/worker-server.manager.d.ts +0 -35
- package/managers/worker-server.manager.js +0 -582
- package/managers/worker-server.manager.js.map +0 -1
- package/methods/accounts.d.ts +0 -2
- package/methods/accounts.js +0 -624
- package/methods/accounts.js.map +0 -1
- package/methods/ai-terminal.d.ts +0 -337
- package/methods/ai-terminal.js +0 -23166
- package/methods/ai-terminal.js.map +0 -1
- package/methods/app-settings.d.ts +0 -2
- package/methods/app-settings.js +0 -169
- package/methods/app-settings.js.map +0 -1
- package/methods/aws.d.ts +0 -2
- package/methods/aws.js +0 -877
- package/methods/aws.js.map +0 -1
- package/methods/collections.d.ts +0 -2
- package/methods/collections.js +0 -719
- package/methods/collections.js.map +0 -1
- package/methods/counters.d.ts +0 -2
- package/methods/counters.js +0 -113
- package/methods/counters.js.map +0 -1
- package/methods/cron-jobs.d.ts +0 -2
- package/methods/cron-jobs.js +0 -2475
- package/methods/cron-jobs.js.map +0 -1
- package/methods/customer-notifications.d.ts +0 -2
- package/methods/customer-notifications.js +0 -528
- package/methods/customer-notifications.js.map +0 -1
- package/methods/diagnostics.d.ts +0 -2
- package/methods/diagnostics.js +0 -703
- package/methods/diagnostics.js.map +0 -1
- package/methods/flag-updates.d.ts +0 -2
- package/methods/flag-updates.js +0 -8
- package/methods/flag-updates.js.map +0 -1
- package/methods/flags.d.ts +0 -2
- package/methods/flags.js +0 -8
- package/methods/flags.js.map +0 -1
- package/methods/logs.d.ts +0 -2
- package/methods/logs.js +0 -751
- package/methods/logs.js.map +0 -1
- package/methods/mongo-explorer.d.ts +0 -2
- package/methods/mongo-explorer.js +0 -1808
- package/methods/mongo-explorer.js.map +0 -1
- package/methods/monitor.d.ts +0 -2
- package/methods/monitor.js +0 -543
- package/methods/monitor.js.map +0 -1
- package/methods/pdf.d.ts +0 -2
- package/methods/pdf.js +0 -1216
- package/methods/pdf.js.map +0 -1
- package/methods/publications.d.ts +0 -1
- package/methods/publications.js +0 -183
- package/methods/publications.js.map +0 -1
- package/methods/report-builder.d.ts +0 -2
- package/methods/report-builder.js +0 -3094
- package/methods/report-builder.js.map +0 -1
- package/methods/support.d.ts +0 -2
- package/methods/support.js +0 -430
- package/methods/support.js.map +0 -1
- package/models/ai-run.model.d.ts +0 -19
- package/models/ai-run.model.js +0 -4
- package/models/ai-run.model.js.map +0 -1
- package/models/ai-terminal-conversation.model.d.ts +0 -17
- package/models/ai-terminal-conversation.model.js +0 -4
- package/models/ai-terminal-conversation.model.js.map +0 -1
- package/models/ai-terminal-issue-report.model.d.ts +0 -19
- package/models/ai-terminal-issue-report.model.js +0 -4
- package/models/ai-terminal-issue-report.model.js.map +0 -1
- package/models/ai-terminal-message.model.d.ts +0 -22
- package/models/ai-terminal-message.model.js +0 -4
- package/models/ai-terminal-message.model.js.map +0 -1
- package/models/app-setting.model.d.ts +0 -16
- package/models/app-setting.model.js +0 -4
- package/models/app-setting.model.js.map +0 -1
- package/models/app-status.model.js +0 -4
- package/models/app-status.model.js.map +0 -1
- package/models/billing-logged-in-users.model.js +0 -4
- package/models/billing-logged-in-users.model.js.map +0 -1
- package/models/collection-document.model.d.ts +0 -21
- package/models/collection-document.model.js +0 -4
- package/models/collection-document.model.js.map +0 -1
- package/models/communication-metric.model.d.ts +0 -20
- package/models/communication-metric.model.js +0 -4
- package/models/communication-metric.model.js.map +0 -1
- package/models/counter.model.js +0 -4
- package/models/counter.model.js.map +0 -1
- package/models/cron-job-history.model.d.ts +0 -15
- package/models/cron-job-history.model.js +0 -4
- package/models/cron-job-history.model.js.map +0 -1
- package/models/cron-job.model.d.ts +0 -14
- package/models/cron-job.model.js +0 -4
- package/models/cron-job.model.js.map +0 -1
- package/models/customer-notification.model.d.ts +0 -26
- package/models/customer-notification.model.js +0 -4
- package/models/customer-notification.model.js.map +0 -1
- package/models/customer-portal-password.model.d.ts +0 -11
- package/models/customer-portal-password.model.js +0 -4
- package/models/customer-portal-password.model.js.map +0 -1
- package/models/dialog.model.d.ts +0 -23
- package/models/dialog.model.js +0 -4
- package/models/dialog.model.js.map +0 -1
- package/models/email-history.model.d.ts +0 -32
- package/models/email-history.model.js.map +0 -1
- package/models/email-verified.model.js +0 -4
- package/models/email-verified.model.js.map +0 -1
- package/models/file.model.js +0 -4
- package/models/file.model.js.map +0 -1
- package/models/flag-update.model.js +0 -4
- package/models/flag-update.model.js.map +0 -1
- package/models/flag.model.js +0 -4
- package/models/flag.model.js.map +0 -1
- package/models/log-method-latency.model.d.ts +0 -10
- package/models/log-method-latency.model.js +0 -4
- package/models/log-method-latency.model.js.map +0 -1
- package/models/log-subscription.model.js +0 -4
- package/models/log-subscription.model.js.map +0 -1
- package/models/log.model.d.ts +0 -17
- package/models/log.model.js +0 -4
- package/models/log.model.js.map +0 -1
- package/models/logged-in-users.model.js +0 -4
- package/models/logged-in-users.model.js.map +0 -1
- package/models/method-response.model.js +0 -4
- package/models/method-response.model.js.map +0 -1
- package/models/method.model.d.ts +0 -26
- package/models/method.model.js +0 -4
- package/models/method.model.js.map +0 -1
- package/models/monitor-cpu.model.js +0 -4
- package/models/monitor-cpu.model.js.map +0 -1
- package/models/monitor-function.model.d.ts +0 -14
- package/models/monitor-function.model.js +0 -4
- package/models/monitor-function.model.js.map +0 -1
- package/models/monitor-memory.model.d.ts +0 -15
- package/models/monitor-memory.model.js +0 -4
- package/models/monitor-memory.model.js.map +0 -1
- package/models/monitor-mongo.model.d.ts +0 -13
- package/models/monitor-mongo.model.js +0 -4
- package/models/monitor-mongo.model.js.map +0 -1
- package/models/notification.model.js +0 -4
- package/models/notification.model.js.map +0 -1
- package/models/openai-usage-ledger.model.d.ts +0 -15
- package/models/openai-usage-ledger.model.js +0 -4
- package/models/openai-usage-ledger.model.js.map +0 -1
- package/models/pagination.model.d.ts +0 -11
- package/models/pagination.model.js +0 -28
- package/models/pagination.model.js.map +0 -1
- package/models/permission.model.d.ts +0 -12
- package/models/permission.model.js +0 -4
- package/models/permission.model.js.map +0 -1
- package/models/report-builder-dashboard-builder.model.d.ts +0 -25
- package/models/report-builder-dashboard-builder.model.js +0 -4
- package/models/report-builder-dashboard-builder.model.js.map +0 -1
- package/models/report-builder-library.model.d.ts +0 -17
- package/models/report-builder-library.model.js +0 -4
- package/models/report-builder-library.model.js.map +0 -1
- package/models/report-builder-report.model.d.ts +0 -121
- package/models/report-builder-report.model.js +0 -4
- package/models/report-builder-report.model.js.map +0 -1
- package/models/report-builder.model.d.ts +0 -61
- package/models/report-builder.model.js +0 -4
- package/models/report-builder.model.js.map +0 -1
- package/models/select-data-label.model.d.ts +0 -9
- package/models/select-data-label.model.js +0 -4
- package/models/select-data-label.model.js.map +0 -1
- package/models/server-message.model.d.ts +0 -32
- package/models/server-message.model.js +0 -4
- package/models/server-message.model.js.map +0 -1
- package/models/slow-query-report.model.d.ts +0 -23
- package/models/slow-query-report.model.js +0 -4
- package/models/slow-query-report.model.js.map +0 -1
- package/models/subscription.model.d.ts +0 -31
- package/models/subscription.model.js +0 -4
- package/models/subscription.model.js.map +0 -1
- package/models/support-ticket.model.d.ts +0 -87
- package/models/support-ticket.model.js +0 -4
- package/models/support-ticket.model.js.map +0 -1
- package/models/user-group.model.d.ts +0 -20
- package/models/user-group.model.js +0 -4
- package/models/user-group.model.js.map +0 -1
- package/models/user-guide.model.js +0 -4
- package/models/user-guide.model.js.map +0 -1
- package/models/user.model.d.ts +0 -84
- package/models/user.model.js +0 -4
- package/models/user.model.js.map +0 -1
- package/private/images/ResolveIO.png +0 -0
- package/public_api.js +0 -125
- package/public_api.js.map +0 -1
- package/publications/ai-terminal.d.ts +0 -1
- package/publications/ai-terminal.js +0 -122
- package/publications/ai-terminal.js.map +0 -1
- package/publications/app-settings.d.ts +0 -2
- package/publications/app-settings.js +0 -28
- package/publications/app-settings.js.map +0 -1
- package/publications/app-status.d.ts +0 -2
- package/publications/app-status.js +0 -16
- package/publications/app-status.js.map +0 -1
- package/publications/cron-jobs.d.ts +0 -2
- package/publications/cron-jobs.js +0 -88
- package/publications/cron-jobs.js.map +0 -1
- package/publications/customer-notifications.d.ts +0 -2
- package/publications/customer-notifications.js +0 -161
- package/publications/customer-notifications.js.map +0 -1
- package/publications/files.d.ts +0 -2
- package/publications/files.js +0 -36
- package/publications/files.js.map +0 -1
- package/publications/flags-update.d.ts +0 -2
- package/publications/flags-update.js +0 -22
- package/publications/flags-update.js.map +0 -1
- package/publications/flags.d.ts +0 -2
- package/publications/flags.js +0 -22
- package/publications/flags.js.map +0 -1
- package/publications/logs.d.ts +0 -2
- package/publications/logs.js +0 -164
- package/publications/logs.js.map +0 -1
- package/publications/notifications.d.ts +0 -2
- package/publications/notifications.js +0 -16
- package/publications/notifications.js.map +0 -1
- package/publications/report-builder-dashboard-builders.d.ts +0 -2
- package/publications/report-builder-dashboard-builders.js +0 -42
- package/publications/report-builder-dashboard-builders.js.map +0 -1
- package/publications/report-builder-libraries.d.ts +0 -2
- package/publications/report-builder-libraries.js +0 -90
- package/publications/report-builder-libraries.js.map +0 -1
- package/publications/report-builder-reports.d.ts +0 -2
- package/publications/report-builder-reports.js +0 -50
- package/publications/report-builder-reports.js.map +0 -1
- package/publications/super-admin.d.ts +0 -2
- package/publications/super-admin.js +0 -16
- package/publications/super-admin.js.map +0 -1
- package/publications/user-groups.d.ts +0 -1
- package/publications/user-groups.js +0 -16
- package/publications/user-groups.js.map +0 -1
- package/publications/user-guides.d.ts +0 -1
- package/publications/user-guides.js +0 -16
- package/publications/user-guides.js.map +0 -1
- package/resolveio-server-app.d.ts +0 -70
- package/resolveio-server-app.js +0 -801
- package/resolveio-server-app.js.map +0 -1
- package/server-app.d.ts +0 -228
- package/server-app.js +0 -3566
- package/server-app.js.map +0 -1
- package/services/codex-client.d.ts +0 -128
- package/services/codex-client.js +0 -1629
- package/services/codex-client.js.map +0 -1
- package/services/openai-client.d.ts +0 -46
- package/services/openai-client.js +0 -318
- package/services/openai-client.js.map +0 -1
- package/types/error-report.d.ts +0 -25
- package/types/error-report.js +0 -4
- package/types/error-report.js.map +0 -1
- package/types/slow-query-report.d.ts +0 -27
- package/types/slow-query-report.js +0 -6
- package/types/slow-query-report.js.map +0 -1
- package/util/ai-qa-policy.d.ts +0 -124
- package/util/ai-qa-policy.js +0 -736
- package/util/ai-qa-policy.js.map +0 -1
- package/util/ai-run-evidence-adapters.d.ts +0 -33
- package/util/ai-run-evidence-adapters.js +0 -660
- package/util/ai-run-evidence-adapters.js.map +0 -1
- package/util/ai-run-evidence-dashboard.d.ts +0 -67
- package/util/ai-run-evidence-dashboard.js +0 -309
- package/util/ai-run-evidence-dashboard.js.map +0 -1
- package/util/ai-run-evidence-eval.d.ts +0 -86
- package/util/ai-run-evidence-eval.js +0 -854
- package/util/ai-run-evidence-eval.js.map +0 -1
- package/util/ai-run-evidence.d.ts +0 -212
- package/util/ai-run-evidence.js +0 -649
- package/util/ai-run-evidence.js.map +0 -1
- package/util/ai-runner-artifacts.d.ts +0 -82
- package/util/ai-runner-artifacts.js +0 -713
- package/util/ai-runner-artifacts.js.map +0 -1
- package/util/ai-runner-qa-auth.d.ts +0 -5
- package/util/ai-runner-qa-auth.js +0 -822
- package/util/ai-runner-qa-auth.js.map +0 -1
- package/util/ai-runner-qa-tools.d.ts +0 -26
- package/util/ai-runner-qa-tools.js +0 -3029
- package/util/ai-runner-qa-tools.js.map +0 -1
- package/util/aicoder-runner-v6.d.ts +0 -168
- package/util/aicoder-runner-v6.js +0 -347
- package/util/aicoder-runner-v6.js.map +0 -1
- package/util/common.d.ts +0 -31
- package/util/common.js +0 -683
- package/util/common.js.map +0 -1
- package/util/customer-portal-password.d.ts +0 -13
- package/util/customer-portal-password.js +0 -209
- package/util/customer-portal-password.js.map +0 -1
- package/util/error-reporter.d.ts +0 -52
- package/util/error-reporter.js +0 -326
- package/util/error-reporter.js.map +0 -1
- package/util/error-tracking.d.ts +0 -13
- package/util/error-tracking.js +0 -120
- package/util/error-tracking.js.map +0 -1
- package/util/openai-usage-cost.d.ts +0 -6
- package/util/openai-usage-cost.js +0 -92
- package/util/openai-usage-cost.js.map +0 -1
- package/util/report-builder-unwinds.d.ts +0 -15
- package/util/report-builder-unwinds.js +0 -156
- package/util/report-builder-unwinds.js.map +0 -1
- package/util/runner-process-janitor.d.ts +0 -27
- package/util/runner-process-janitor.js +0 -208
- package/util/runner-process-janitor.js.map +0 -1
- package/util/schema-report-builder.d.ts +0 -6
- package/util/schema-report-builder.js +0 -481
- package/util/schema-report-builder.js.map +0 -1
- package/util/slow-query-reporter.d.ts +0 -28
- package/util/slow-query-reporter.js +0 -226
- package/util/slow-query-reporter.js.map +0 -1
- package/util/subscription-dependency-context.d.ts +0 -34
- package/util/subscription-dependency-context.js +0 -1283
- package/util/subscription-dependency-context.js.map +0 -1
- package/util/support-runner-v5.d.ts +0 -250
- package/util/support-runner-v5.js +0 -634
- package/util/support-runner-v5.js.map +0 -1
- package/util/tokenizer.d.ts +0 -5
- package/util/tokenizer.js +0 -41
- package/util/tokenizer.js.map +0 -1
- package/workers/codex-runner.worker.d.ts +0 -1
- package/workers/codex-runner.worker.js +0 -192
- package/workers/codex-runner.worker.js.map +0 -1
- /package/{private → src/private}/email-templates/enrollment.html +0 -0
- /package/{private → src/private}/email-templates/forgot-password.html +0 -0
- /package/{private → src/private}/email-templates/support-ticket-deleted.html +0 -0
- /package/{private → src/private}/email-templates/support-ticket-modified.html +0 -0
- /package/{private → src/private}/email-templates/support-ticket.html +0 -0
- /package/{public_api.d.ts → src/public_api.ts} +0 -0
|
@@ -0,0 +1,897 @@
|
|
|
1
|
+
export type ResolveIOSupportV5StepType =
|
|
2
|
+
| 'compile_check'
|
|
3
|
+
| 'startup_check'
|
|
4
|
+
| 'live_seed'
|
|
5
|
+
| 'auth_bootstrap'
|
|
6
|
+
| 'route_probe'
|
|
7
|
+
| 'qa_row'
|
|
8
|
+
| 'build_repair'
|
|
9
|
+
| 'qa_retest'
|
|
10
|
+
| 'pr_review'
|
|
11
|
+
| 'artifact_package'
|
|
12
|
+
| 'cleanup';
|
|
13
|
+
|
|
14
|
+
export type ResolveIOSupportV5Outcome =
|
|
15
|
+
| 'pass'
|
|
16
|
+
| 'needs_repair'
|
|
17
|
+
| 'retry_same_step'
|
|
18
|
+
| 'park_manual'
|
|
19
|
+
| 'budget_stop'
|
|
20
|
+
| 'infra_retry'
|
|
21
|
+
| 'ready_for_merge';
|
|
22
|
+
|
|
23
|
+
export type ResolveIOSupportV5Lane = 'build' | 'qa' | 'review' | 'supervisor';
|
|
24
|
+
|
|
25
|
+
export type ResolveIOSupportV5MicrotaskStatus =
|
|
26
|
+
| 'pending'
|
|
27
|
+
| 'in_progress'
|
|
28
|
+
| 'pass'
|
|
29
|
+
| 'needs_repair'
|
|
30
|
+
| 'blocked'
|
|
31
|
+
| 'parked';
|
|
32
|
+
|
|
33
|
+
export type ResolveIOSupportV5MicrotaskType =
|
|
34
|
+
| ResolveIOSupportV5StepType
|
|
35
|
+
| 'planning'
|
|
36
|
+
| 'scope_slice'
|
|
37
|
+
| 'product_repair'
|
|
38
|
+
| 'runner_repair';
|
|
39
|
+
|
|
40
|
+
export interface ResolveIOSupportV5PromptBudget {
|
|
41
|
+
initialPlannerCap: number;
|
|
42
|
+
buildMicrotaskCap: number;
|
|
43
|
+
buildMicrotaskHardCap: number;
|
|
44
|
+
qaMicrotaskCap: number;
|
|
45
|
+
qaMicrotaskHardCap: number;
|
|
46
|
+
repairMicrotaskCap: number;
|
|
47
|
+
repairMicrotaskHardCap: number;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface ResolveIOSupportV5Microtask {
|
|
51
|
+
microtaskId: string;
|
|
52
|
+
lane: ResolveIOSupportV5Lane;
|
|
53
|
+
type: ResolveIOSupportV5MicrotaskType;
|
|
54
|
+
status: ResolveIOSupportV5MicrotaskStatus;
|
|
55
|
+
objective: string;
|
|
56
|
+
targetFiles: string[];
|
|
57
|
+
contextRefs: string[];
|
|
58
|
+
selfGate: string;
|
|
59
|
+
acceptanceProof: string;
|
|
60
|
+
threadKey: string;
|
|
61
|
+
promptTokenEstimate?: number;
|
|
62
|
+
attempts: number;
|
|
63
|
+
dependsOn: string[];
|
|
64
|
+
parentScopeId?: string;
|
|
65
|
+
blocker?: string;
|
|
66
|
+
createdAt: string;
|
|
67
|
+
updatedAt: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface ResolveIOSupportV5UsageSection {
|
|
71
|
+
name: string;
|
|
72
|
+
tokenEstimate: number;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface ResolveIOSupportV5MicrotaskUsage {
|
|
76
|
+
microtaskId: string;
|
|
77
|
+
lane: ResolveIOSupportV5Lane;
|
|
78
|
+
model?: string;
|
|
79
|
+
threadKey?: string;
|
|
80
|
+
reuseThread: boolean;
|
|
81
|
+
freshReason?: string;
|
|
82
|
+
promptTokenEstimate: number;
|
|
83
|
+
promptSections: ResolveIOSupportV5UsageSection[];
|
|
84
|
+
actualInputTokens?: number;
|
|
85
|
+
actualCachedInputTokens?: number;
|
|
86
|
+
actualOutputTokens?: number;
|
|
87
|
+
durationMs?: number;
|
|
88
|
+
outcome?: ResolveIOSupportV5Outcome | ResolveIOSupportV5MicrotaskStatus;
|
|
89
|
+
recordedAt: string;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface ResolveIOSupportV5Budget {
|
|
93
|
+
maxPromptTokensPerNonInitialStep: number;
|
|
94
|
+
maxLoopsPerTicket: number;
|
|
95
|
+
maxRepeatedNoProgress: number;
|
|
96
|
+
maxRuntimeMinutesPerLoop: number;
|
|
97
|
+
totalPromptTokenEstimate: number;
|
|
98
|
+
totalRuntimeMs: number;
|
|
99
|
+
loopCount: number;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export interface ResolveIOSupportV5LaneMemory {
|
|
103
|
+
lane: ResolveIOSupportV5Lane;
|
|
104
|
+
model: string;
|
|
105
|
+
threadKey: string;
|
|
106
|
+
scopeSummary: string;
|
|
107
|
+
activeBlocker: string;
|
|
108
|
+
activeQaRow?: {
|
|
109
|
+
index?: number;
|
|
110
|
+
workflow?: string;
|
|
111
|
+
route?: string;
|
|
112
|
+
assertion?: string;
|
|
113
|
+
status?: string;
|
|
114
|
+
};
|
|
115
|
+
changedFiles: string[];
|
|
116
|
+
artifactPaths: string[];
|
|
117
|
+
latestPromptTokenEstimate?: number;
|
|
118
|
+
updatedAt: string;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface ResolveIOSupportV5SupervisorState {
|
|
122
|
+
version: 'v5';
|
|
123
|
+
status: 'active' | 'parked' | 'complete';
|
|
124
|
+
currentGoal: string;
|
|
125
|
+
approvedScope: string;
|
|
126
|
+
prBranch: string;
|
|
127
|
+
activeStep: ResolveIOSupportV5StepType;
|
|
128
|
+
activeBlocker: string;
|
|
129
|
+
lastGoodCheckpoint: string;
|
|
130
|
+
currentQaRow?: ResolveIOSupportV5LaneMemory['activeQaRow'];
|
|
131
|
+
processLease?: {
|
|
132
|
+
runId?: string;
|
|
133
|
+
token?: string;
|
|
134
|
+
generation?: number;
|
|
135
|
+
workspace?: string;
|
|
136
|
+
lane?: string;
|
|
137
|
+
};
|
|
138
|
+
artifactLinks: string[];
|
|
139
|
+
noEmailUnlessApproved: boolean;
|
|
140
|
+
updatedAt: string;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export interface ResolveIOSupportV5StepRecord {
|
|
144
|
+
microtaskId?: string;
|
|
145
|
+
stepType: ResolveIOSupportV5StepType;
|
|
146
|
+
outcome: ResolveIOSupportV5Outcome;
|
|
147
|
+
lane: ResolveIOSupportV5Lane;
|
|
148
|
+
model?: string;
|
|
149
|
+
threadKey?: string;
|
|
150
|
+
promptTokenEstimate?: number;
|
|
151
|
+
runtimeMs?: number;
|
|
152
|
+
summary: string;
|
|
153
|
+
blocker?: string;
|
|
154
|
+
changedFiles?: string[];
|
|
155
|
+
artifactPaths?: string[];
|
|
156
|
+
recordedAt: string;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export interface ResolveIOSupportV5RunnerIncident {
|
|
160
|
+
incidentClass: string;
|
|
161
|
+
summary: string;
|
|
162
|
+
stepType?: ResolveIOSupportV5StepType;
|
|
163
|
+
blockerFingerprint?: string;
|
|
164
|
+
artifactPaths?: string[];
|
|
165
|
+
recordedAt: string;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export interface ResolveIOSupportV5StateBundle {
|
|
169
|
+
supportWorkflowVersion: 'v5';
|
|
170
|
+
supportV5SupervisorState: ResolveIOSupportV5SupervisorState;
|
|
171
|
+
supportV5LaneMemory: {
|
|
172
|
+
build: ResolveIOSupportV5LaneMemory;
|
|
173
|
+
qa: ResolveIOSupportV5LaneMemory;
|
|
174
|
+
};
|
|
175
|
+
supportV5StepHistory: ResolveIOSupportV5StepRecord[];
|
|
176
|
+
supportV5Budget: ResolveIOSupportV5Budget;
|
|
177
|
+
supportV5RunnerIncidents: ResolveIOSupportV5RunnerIncident[];
|
|
178
|
+
supportV5MicrotaskLedger: ResolveIOSupportV5Microtask[];
|
|
179
|
+
supportV5ActiveMicrotaskId?: string;
|
|
180
|
+
supportV5ScopeDigest?: string;
|
|
181
|
+
supportV5MicrotaskUsageHistory: ResolveIOSupportV5MicrotaskUsage[];
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export interface ResolveIOSupportV5InitializeInput {
|
|
185
|
+
jobId: string;
|
|
186
|
+
ticketId?: string;
|
|
187
|
+
ticketNumber?: string;
|
|
188
|
+
title?: string;
|
|
189
|
+
description?: string;
|
|
190
|
+
approvedScopeRequirements?: string[];
|
|
191
|
+
approvedScopeHours?: number | null;
|
|
192
|
+
prBranch?: string;
|
|
193
|
+
buildThreadKey?: string;
|
|
194
|
+
qaThreadKey?: string;
|
|
195
|
+
processLease?: ResolveIOSupportV5SupervisorState['processLease'];
|
|
196
|
+
now?: Date | string;
|
|
197
|
+
existing?: Partial<ResolveIOSupportV5StateBundle>;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export interface ResolveIOSupportV5StepInput {
|
|
201
|
+
microtaskId?: string;
|
|
202
|
+
stepType: ResolveIOSupportV5StepType;
|
|
203
|
+
outcome: ResolveIOSupportV5Outcome;
|
|
204
|
+
lane: ResolveIOSupportV5Lane;
|
|
205
|
+
model?: string;
|
|
206
|
+
threadKey?: string;
|
|
207
|
+
promptTokenEstimate?: number;
|
|
208
|
+
runtimeMs?: number;
|
|
209
|
+
summary?: string;
|
|
210
|
+
blocker?: string;
|
|
211
|
+
changedFiles?: string[];
|
|
212
|
+
artifactPaths?: string[];
|
|
213
|
+
activeQaRow?: ResolveIOSupportV5LaneMemory['activeQaRow'];
|
|
214
|
+
now?: Date | string;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export interface ResolveIOSupportV5ContinuationDecision {
|
|
218
|
+
action: 'continue' | 'park';
|
|
219
|
+
reason: string;
|
|
220
|
+
nextStep: ResolveIOSupportV5StepType;
|
|
221
|
+
repeatedNoProgressCount: number;
|
|
222
|
+
budgetExceeded: boolean;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
function isoNow(value?: Date | string): string {
|
|
226
|
+
if (value instanceof Date) {
|
|
227
|
+
return value.toISOString();
|
|
228
|
+
}
|
|
229
|
+
const parsed = value ? new Date(value) : new Date();
|
|
230
|
+
if (Number.isFinite(parsed.getTime())) {
|
|
231
|
+
return parsed.toISOString();
|
|
232
|
+
}
|
|
233
|
+
return new Date().toISOString();
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
function cleanText(value: any, max = 2000): string {
|
|
237
|
+
return String(value || '').replace(/\s+/g, ' ').trim().slice(0, max);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function cleanList(values: any, limit = 20, max = 500): string[] {
|
|
241
|
+
if (!Array.isArray(values)) {
|
|
242
|
+
return [];
|
|
243
|
+
}
|
|
244
|
+
const result: string[] = [];
|
|
245
|
+
for (const value of values) {
|
|
246
|
+
const normalized = cleanText(value, max);
|
|
247
|
+
if (normalized && !result.includes(normalized)) {
|
|
248
|
+
result.push(normalized);
|
|
249
|
+
}
|
|
250
|
+
if (result.length >= limit) {
|
|
251
|
+
break;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
return result;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
function stableIdFromText(prefix: string, value: string): string {
|
|
258
|
+
const text = cleanText(value, 2000).toLowerCase();
|
|
259
|
+
let hash = 0;
|
|
260
|
+
for (let index = 0; index < text.length; index += 1) {
|
|
261
|
+
hash = ((hash << 5) - hash + text.charCodeAt(index)) | 0;
|
|
262
|
+
}
|
|
263
|
+
return `${prefix}-${Math.abs(hash).toString(36) || '0'}`;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
function estimateTextTokens(value: string): number {
|
|
267
|
+
const text = String(value || '');
|
|
268
|
+
if (!text) {
|
|
269
|
+
return 0;
|
|
270
|
+
}
|
|
271
|
+
return Math.max(1, Math.ceil(text.length / 4));
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
export function fingerprintResolveIOSupportV5Blocker(value: any): string {
|
|
275
|
+
const text = cleanText(value, 4000)
|
|
276
|
+
.toLowerCase()
|
|
277
|
+
.replace(/[a-f0-9]{16,}/g, '<id>')
|
|
278
|
+
.replace(/\b\d{2,}\b/g, '<n>')
|
|
279
|
+
.replace(/\bline\s+<n>\b/g, 'line <n>');
|
|
280
|
+
let hash = 0;
|
|
281
|
+
for (let index = 0; index < text.length; index += 1) {
|
|
282
|
+
hash = ((hash << 5) - hash + text.charCodeAt(index)) | 0;
|
|
283
|
+
}
|
|
284
|
+
return `v5-${Math.abs(hash).toString(36)}`;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
export function buildResolveIOSupportV5Budget(existing?: Partial<ResolveIOSupportV5Budget>): ResolveIOSupportV5Budget {
|
|
288
|
+
return {
|
|
289
|
+
maxPromptTokensPerNonInitialStep: Number(existing?.maxPromptTokensPerNonInitialStep || 1800),
|
|
290
|
+
maxLoopsPerTicket: Number(existing?.maxLoopsPerTicket || 24),
|
|
291
|
+
maxRepeatedNoProgress: Number(existing?.maxRepeatedNoProgress || 2),
|
|
292
|
+
maxRuntimeMinutesPerLoop: Number(existing?.maxRuntimeMinutesPerLoop || 15),
|
|
293
|
+
totalPromptTokenEstimate: Number(existing?.totalPromptTokenEstimate || 0),
|
|
294
|
+
totalRuntimeMs: Number(existing?.totalRuntimeMs || 0),
|
|
295
|
+
loopCount: Number(existing?.loopCount || 0)
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
export function buildResolveIOSupportV5PromptBudget(existing?: Partial<ResolveIOSupportV5PromptBudget>): ResolveIOSupportV5PromptBudget {
|
|
300
|
+
return {
|
|
301
|
+
initialPlannerCap: Number(existing?.initialPlannerCap || 6000),
|
|
302
|
+
buildMicrotaskCap: Number(existing?.buildMicrotaskCap || 1800),
|
|
303
|
+
buildMicrotaskHardCap: Number(existing?.buildMicrotaskHardCap || 2500),
|
|
304
|
+
qaMicrotaskCap: Number(existing?.qaMicrotaskCap || 1500),
|
|
305
|
+
qaMicrotaskHardCap: Number(existing?.qaMicrotaskHardCap || 2200),
|
|
306
|
+
repairMicrotaskCap: Number(existing?.repairMicrotaskCap || 1200),
|
|
307
|
+
repairMicrotaskHardCap: Number(existing?.repairMicrotaskHardCap || 1800)
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
export function buildResolveIOSupportV5ScopeDigest(input: {
|
|
312
|
+
goal?: string;
|
|
313
|
+
approvedScope?: string | string[];
|
|
314
|
+
prBranch?: string;
|
|
315
|
+
maxTokens?: number;
|
|
316
|
+
}): string {
|
|
317
|
+
const scope = Array.isArray(input.approvedScope)
|
|
318
|
+
? cleanList(input.approvedScope, 30, 220).join(' | ')
|
|
319
|
+
: cleanText(input.approvedScope, 4000);
|
|
320
|
+
const raw = [
|
|
321
|
+
input.goal ? `Goal: ${cleanText(input.goal, 300)}` : '',
|
|
322
|
+
scope ? `Approved scope: ${scope}` : '',
|
|
323
|
+
input.prBranch ? `PR branch: ${cleanText(input.prBranch, 160)}` : ''
|
|
324
|
+
].filter(Boolean).join('\n');
|
|
325
|
+
const maxChars = Math.max(400, Math.floor(Number(input.maxTokens || 1000) * 4));
|
|
326
|
+
return raw.slice(0, maxChars);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
export function buildResolveIOSupportV5MicrotaskLedger(input: {
|
|
330
|
+
scopeDigest: string;
|
|
331
|
+
requirements?: string[];
|
|
332
|
+
buildThreadKey: string;
|
|
333
|
+
qaThreadKey: string;
|
|
334
|
+
now?: Date | string;
|
|
335
|
+
existing?: ResolveIOSupportV5Microtask[];
|
|
336
|
+
}): ResolveIOSupportV5Microtask[] {
|
|
337
|
+
const existing = Array.isArray(input.existing) ? input.existing : [];
|
|
338
|
+
const completedByObjective = new Map<string, ResolveIOSupportV5Microtask>();
|
|
339
|
+
for (const task of existing) {
|
|
340
|
+
if (task && (task.status === 'pass' || task.status === 'parked')) {
|
|
341
|
+
completedByObjective.set(cleanText(task.objective, 500).toLowerCase(), task);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
const now = isoNow(input.now);
|
|
345
|
+
const requirements = cleanList(input.requirements, 30, 240);
|
|
346
|
+
const sourceRequirements = requirements.length
|
|
347
|
+
? requirements
|
|
348
|
+
: cleanText(input.scopeDigest, 1000).split(/\s+\|\s+|\r?\n/g).map((line) => line.trim()).filter(Boolean).slice(0, 12);
|
|
349
|
+
const ledger: ResolveIOSupportV5Microtask[] = [];
|
|
350
|
+
sourceRequirements.forEach((requirement, index) => {
|
|
351
|
+
const objective = cleanText(requirement, 240);
|
|
352
|
+
if (!objective) {
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
const existingCompleted = completedByObjective.get(objective.toLowerCase());
|
|
356
|
+
const buildId = stableIdFromText(`build-${index + 1}`, objective);
|
|
357
|
+
const qaId = stableIdFromText(`qa-${index + 1}`, objective);
|
|
358
|
+
ledger.push(existingCompleted && existingCompleted.lane === 'build' ? existingCompleted : {
|
|
359
|
+
microtaskId: buildId,
|
|
360
|
+
lane: 'build',
|
|
361
|
+
type: 'build_repair',
|
|
362
|
+
status: 'pending',
|
|
363
|
+
objective,
|
|
364
|
+
targetFiles: [],
|
|
365
|
+
contextRefs: ['scope_digest'],
|
|
366
|
+
selfGate: 'Run the smallest compile/type/unit check that proves this one behavior.',
|
|
367
|
+
acceptanceProof: 'Concrete code/data proof for this behavior, with changed files listed.',
|
|
368
|
+
threadKey: input.buildThreadKey,
|
|
369
|
+
attempts: 0,
|
|
370
|
+
dependsOn: [],
|
|
371
|
+
parentScopeId: stableIdFromText('scope', objective),
|
|
372
|
+
createdAt: now,
|
|
373
|
+
updatedAt: now
|
|
374
|
+
});
|
|
375
|
+
ledger.push({
|
|
376
|
+
microtaskId: qaId,
|
|
377
|
+
lane: 'qa',
|
|
378
|
+
type: 'qa_row',
|
|
379
|
+
status: 'pending',
|
|
380
|
+
objective: `QA proof for: ${objective}`,
|
|
381
|
+
targetFiles: [],
|
|
382
|
+
contextRefs: ['scope_digest', buildId],
|
|
383
|
+
selfGate: 'Drive this one customer-facing workflow row in browser/localhost and capture one captioned proof artifact.',
|
|
384
|
+
acceptanceProof: 'QA matrix row pass with route/data assertion, screenshot/caption artifact, and persisted before/after row/count/value proof for data-changing workflows.',
|
|
385
|
+
threadKey: input.qaThreadKey,
|
|
386
|
+
attempts: 0,
|
|
387
|
+
dependsOn: [buildId],
|
|
388
|
+
parentScopeId: stableIdFromText('scope', objective),
|
|
389
|
+
createdAt: now,
|
|
390
|
+
updatedAt: now
|
|
391
|
+
});
|
|
392
|
+
});
|
|
393
|
+
return ledger.length ? ledger : existing.slice(-80);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
export function selectResolveIOSupportV5ActiveMicrotask(
|
|
397
|
+
ledger: ResolveIOSupportV5Microtask[] = [],
|
|
398
|
+
preferredId?: string
|
|
399
|
+
): ResolveIOSupportV5Microtask | undefined {
|
|
400
|
+
const byPreferred = preferredId ? ledger.find((task) => task.microtaskId === preferredId && !['pass', 'parked'].includes(task.status)) : undefined;
|
|
401
|
+
if (byPreferred) {
|
|
402
|
+
return byPreferred;
|
|
403
|
+
}
|
|
404
|
+
return ledger.find((task) => task.status === 'needs_repair')
|
|
405
|
+
|| ledger.find((task) => task.status === 'in_progress')
|
|
406
|
+
|| ledger.find((task) => task.lane === 'build' && /repair/i.test(String(task.type || '')) && task.status === 'pending')
|
|
407
|
+
|| ledger.find((task) => task.status === 'pending')
|
|
408
|
+
|| ledger.find((task) => task.status === 'blocked');
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
export function initializeResolveIOSupportV5State(input: ResolveIOSupportV5InitializeInput): ResolveIOSupportV5StateBundle {
|
|
412
|
+
const now = isoNow(input.now);
|
|
413
|
+
const existing = input.existing || {};
|
|
414
|
+
const existingSupervisor = existing.supportV5SupervisorState;
|
|
415
|
+
const existingLaneMemory = existing.supportV5LaneMemory || {} as ResolveIOSupportV5StateBundle['supportV5LaneMemory'];
|
|
416
|
+
const scope = cleanList(input.approvedScopeRequirements, 24, 240).join(' | ')
|
|
417
|
+
|| cleanText(input.description, 1000)
|
|
418
|
+
|| cleanText(input.title, 300);
|
|
419
|
+
const ticketLabel = cleanText(input.ticketNumber || input.ticketId || input.jobId, 120);
|
|
420
|
+
const buildThreadKey = cleanText(input.buildThreadKey || existingLaneMemory.build?.threadKey || `support:${input.ticketId || input.jobId}:job:${input.jobId}:build`, 240);
|
|
421
|
+
const qaThreadKey = cleanText(input.qaThreadKey || existingLaneMemory.qa?.threadKey || `support:${input.ticketId || input.jobId}:job:${input.jobId}:qa`, 240);
|
|
422
|
+
const budget = buildResolveIOSupportV5Budget(existing.supportV5Budget);
|
|
423
|
+
const scopeDigest = cleanText((existing as any).supportV5ScopeDigest, 4000) || buildResolveIOSupportV5ScopeDigest({
|
|
424
|
+
goal: existingSupervisor?.currentGoal || `Resolve support ticket ${ticketLabel}`,
|
|
425
|
+
approvedScope: scope,
|
|
426
|
+
prBranch: input.prBranch || existingSupervisor?.prBranch || ''
|
|
427
|
+
});
|
|
428
|
+
const ledger = buildResolveIOSupportV5MicrotaskLedger({
|
|
429
|
+
scopeDigest,
|
|
430
|
+
requirements: cleanList(input.approvedScopeRequirements, 30, 240),
|
|
431
|
+
buildThreadKey,
|
|
432
|
+
qaThreadKey,
|
|
433
|
+
now,
|
|
434
|
+
existing: (existing as any).supportV5MicrotaskLedger
|
|
435
|
+
});
|
|
436
|
+
const activeMicrotask = selectResolveIOSupportV5ActiveMicrotask(ledger, (existing as any).supportV5ActiveMicrotaskId);
|
|
437
|
+
return {
|
|
438
|
+
supportWorkflowVersion: 'v5',
|
|
439
|
+
supportV5SupervisorState: {
|
|
440
|
+
version: 'v5',
|
|
441
|
+
status: existingSupervisor?.status || 'active',
|
|
442
|
+
currentGoal: existingSupervisor?.currentGoal || `Resolve support ticket ${ticketLabel}`,
|
|
443
|
+
approvedScope: existingSupervisor?.approvedScope || scope,
|
|
444
|
+
prBranch: cleanText(input.prBranch || existingSupervisor?.prBranch || '', 240),
|
|
445
|
+
activeStep: existingSupervisor?.activeStep || 'compile_check',
|
|
446
|
+
activeBlocker: existingSupervisor?.activeBlocker || '',
|
|
447
|
+
lastGoodCheckpoint: existingSupervisor?.lastGoodCheckpoint || 'v5_initialized',
|
|
448
|
+
currentQaRow: existingSupervisor?.currentQaRow,
|
|
449
|
+
processLease: input.processLease || existingSupervisor?.processLease,
|
|
450
|
+
artifactLinks: cleanList(existingSupervisor?.artifactLinks, 40, 500),
|
|
451
|
+
noEmailUnlessApproved: true,
|
|
452
|
+
updatedAt: now
|
|
453
|
+
},
|
|
454
|
+
supportV5LaneMemory: {
|
|
455
|
+
build: {
|
|
456
|
+
lane: 'build',
|
|
457
|
+
model: existingLaneMemory.build?.model || 'gpt-5.3-codex',
|
|
458
|
+
threadKey: buildThreadKey,
|
|
459
|
+
scopeSummary: existingLaneMemory.build?.scopeSummary || scope,
|
|
460
|
+
activeBlocker: existingLaneMemory.build?.activeBlocker || '',
|
|
461
|
+
activeQaRow: existingLaneMemory.build?.activeQaRow,
|
|
462
|
+
changedFiles: cleanList(existingLaneMemory.build?.changedFiles, 80, 500),
|
|
463
|
+
artifactPaths: cleanList(existingLaneMemory.build?.artifactPaths, 80, 500),
|
|
464
|
+
latestPromptTokenEstimate: Number(existingLaneMemory.build?.latestPromptTokenEstimate || 0) || undefined,
|
|
465
|
+
updatedAt: existingLaneMemory.build?.updatedAt || now
|
|
466
|
+
},
|
|
467
|
+
qa: {
|
|
468
|
+
lane: 'qa',
|
|
469
|
+
model: existingLaneMemory.qa?.model || 'gpt-5.4-mini',
|
|
470
|
+
threadKey: qaThreadKey,
|
|
471
|
+
scopeSummary: existingLaneMemory.qa?.scopeSummary || scope,
|
|
472
|
+
activeBlocker: existingLaneMemory.qa?.activeBlocker || '',
|
|
473
|
+
activeQaRow: existingLaneMemory.qa?.activeQaRow,
|
|
474
|
+
changedFiles: cleanList(existingLaneMemory.qa?.changedFiles, 80, 500),
|
|
475
|
+
artifactPaths: cleanList(existingLaneMemory.qa?.artifactPaths, 80, 500),
|
|
476
|
+
latestPromptTokenEstimate: Number(existingLaneMemory.qa?.latestPromptTokenEstimate || 0) || undefined,
|
|
477
|
+
updatedAt: existingLaneMemory.qa?.updatedAt || now
|
|
478
|
+
}
|
|
479
|
+
},
|
|
480
|
+
supportV5StepHistory: Array.isArray(existing.supportV5StepHistory)
|
|
481
|
+
? existing.supportV5StepHistory.slice(-80)
|
|
482
|
+
: [],
|
|
483
|
+
supportV5Budget: budget,
|
|
484
|
+
supportV5RunnerIncidents: Array.isArray(existing.supportV5RunnerIncidents)
|
|
485
|
+
? existing.supportV5RunnerIncidents.slice(-80)
|
|
486
|
+
: [],
|
|
487
|
+
supportV5MicrotaskLedger: ledger,
|
|
488
|
+
supportV5ActiveMicrotaskId: activeMicrotask?.microtaskId,
|
|
489
|
+
supportV5ScopeDigest: scopeDigest,
|
|
490
|
+
supportV5MicrotaskUsageHistory: Array.isArray((existing as any).supportV5MicrotaskUsageHistory)
|
|
491
|
+
? (existing as any).supportV5MicrotaskUsageHistory.slice(-200)
|
|
492
|
+
: []
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
export function recordResolveIOSupportV5Step(
|
|
497
|
+
bundle: ResolveIOSupportV5StateBundle,
|
|
498
|
+
step: ResolveIOSupportV5StepInput
|
|
499
|
+
): ResolveIOSupportV5StateBundle {
|
|
500
|
+
const now = isoNow(step.now);
|
|
501
|
+
const promptTokens = Math.max(0, Number(step.promptTokenEstimate || 0) || 0);
|
|
502
|
+
const runtimeMs = Math.max(0, Number(step.runtimeMs || 0) || 0);
|
|
503
|
+
const microtaskId = cleanText(step.microtaskId || bundle.supportV5ActiveMicrotaskId, 160);
|
|
504
|
+
const record: ResolveIOSupportV5StepRecord = {
|
|
505
|
+
...(microtaskId ? { microtaskId } : {}),
|
|
506
|
+
stepType: step.stepType,
|
|
507
|
+
outcome: step.outcome,
|
|
508
|
+
lane: step.lane,
|
|
509
|
+
model: cleanText(step.model, 80),
|
|
510
|
+
threadKey: cleanText(step.threadKey, 240),
|
|
511
|
+
promptTokenEstimate: promptTokens || undefined,
|
|
512
|
+
runtimeMs: runtimeMs || undefined,
|
|
513
|
+
summary: cleanText(step.summary || step.blocker || step.outcome, 1200),
|
|
514
|
+
blocker: cleanText(step.blocker, 1200),
|
|
515
|
+
changedFiles: cleanList(step.changedFiles, 80, 500),
|
|
516
|
+
artifactPaths: cleanList(step.artifactPaths, 80, 500),
|
|
517
|
+
recordedAt: now
|
|
518
|
+
};
|
|
519
|
+
const laneMemory = { ...bundle.supportV5LaneMemory };
|
|
520
|
+
if (step.lane === 'build' || step.lane === 'qa') {
|
|
521
|
+
const previous = laneMemory[step.lane];
|
|
522
|
+
laneMemory[step.lane] = {
|
|
523
|
+
...previous,
|
|
524
|
+
activeBlocker: record.blocker || previous.activeBlocker || '',
|
|
525
|
+
activeQaRow: step.activeQaRow || previous.activeQaRow,
|
|
526
|
+
changedFiles: record.changedFiles?.length ? record.changedFiles : previous.changedFiles,
|
|
527
|
+
artifactPaths: record.artifactPaths?.length ? record.artifactPaths : previous.artifactPaths,
|
|
528
|
+
latestPromptTokenEstimate: promptTokens || previous.latestPromptTokenEstimate,
|
|
529
|
+
updatedAt: now
|
|
530
|
+
};
|
|
531
|
+
}
|
|
532
|
+
const supervisor = {
|
|
533
|
+
...bundle.supportV5SupervisorState,
|
|
534
|
+
status: step.outcome === 'ready_for_merge' ? 'complete' as const : (step.outcome === 'park_manual' || step.outcome === 'budget_stop' ? 'parked' as const : 'active' as const),
|
|
535
|
+
activeStep: step.stepType,
|
|
536
|
+
activeBlocker: record.blocker || '',
|
|
537
|
+
currentQaRow: step.activeQaRow || bundle.supportV5SupervisorState.currentQaRow,
|
|
538
|
+
lastGoodCheckpoint: step.outcome === 'pass' || step.outcome === 'ready_for_merge'
|
|
539
|
+
? step.stepType
|
|
540
|
+
: bundle.supportV5SupervisorState.lastGoodCheckpoint,
|
|
541
|
+
artifactLinks: Array.from(new Set([
|
|
542
|
+
...bundle.supportV5SupervisorState.artifactLinks,
|
|
543
|
+
...(record.artifactPaths || [])
|
|
544
|
+
])).slice(-80),
|
|
545
|
+
updatedAt: now
|
|
546
|
+
};
|
|
547
|
+
const ledger = (bundle.supportV5MicrotaskLedger || []).map((task) => {
|
|
548
|
+
if (task.microtaskId !== bundle.supportV5ActiveMicrotaskId) {
|
|
549
|
+
return task;
|
|
550
|
+
}
|
|
551
|
+
const status: ResolveIOSupportV5MicrotaskStatus = step.outcome === 'pass' || step.outcome === 'ready_for_merge'
|
|
552
|
+
? 'pass'
|
|
553
|
+
: step.outcome === 'park_manual' || step.outcome === 'budget_stop'
|
|
554
|
+
? 'parked'
|
|
555
|
+
: step.outcome === 'needs_repair' || step.outcome === 'retry_same_step'
|
|
556
|
+
? 'needs_repair'
|
|
557
|
+
: 'in_progress';
|
|
558
|
+
return {
|
|
559
|
+
...task,
|
|
560
|
+
status,
|
|
561
|
+
blocker: record.blocker || task.blocker,
|
|
562
|
+
promptTokenEstimate: promptTokens || task.promptTokenEstimate,
|
|
563
|
+
attempts: task.attempts + (step.outcome === 'pass' || step.outcome === 'ready_for_merge' ? 0 : 1),
|
|
564
|
+
updatedAt: now
|
|
565
|
+
};
|
|
566
|
+
});
|
|
567
|
+
const nextMicrotask = selectResolveIOSupportV5ActiveMicrotask(ledger, bundle.supportV5ActiveMicrotaskId);
|
|
568
|
+
return {
|
|
569
|
+
...bundle,
|
|
570
|
+
supportV5SupervisorState: supervisor,
|
|
571
|
+
supportV5LaneMemory: laneMemory,
|
|
572
|
+
supportV5StepHistory: [...bundle.supportV5StepHistory, record].slice(-100),
|
|
573
|
+
supportV5Budget: {
|
|
574
|
+
...bundle.supportV5Budget,
|
|
575
|
+
totalPromptTokenEstimate: bundle.supportV5Budget.totalPromptTokenEstimate + promptTokens,
|
|
576
|
+
totalRuntimeMs: bundle.supportV5Budget.totalRuntimeMs + runtimeMs,
|
|
577
|
+
loopCount: bundle.supportV5Budget.loopCount + 1
|
|
578
|
+
},
|
|
579
|
+
supportV5MicrotaskLedger: ledger,
|
|
580
|
+
supportV5ActiveMicrotaskId: nextMicrotask?.microtaskId,
|
|
581
|
+
supportV5MicrotaskUsageHistory: bundle.supportV5MicrotaskUsageHistory || []
|
|
582
|
+
};
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
export function recordResolveIOSupportV5MicrotaskUsage(
|
|
586
|
+
bundle: ResolveIOSupportV5StateBundle,
|
|
587
|
+
usage: Omit<ResolveIOSupportV5MicrotaskUsage, 'recordedAt'>
|
|
588
|
+
): ResolveIOSupportV5StateBundle {
|
|
589
|
+
const record: ResolveIOSupportV5MicrotaskUsage = {
|
|
590
|
+
...usage,
|
|
591
|
+
microtaskId: cleanText(usage.microtaskId, 160),
|
|
592
|
+
threadKey: cleanText(usage.threadKey, 240),
|
|
593
|
+
model: cleanText(usage.model, 80),
|
|
594
|
+
promptTokenEstimate: Math.max(0, Number(usage.promptTokenEstimate || 0) || 0),
|
|
595
|
+
promptSections: Array.isArray(usage.promptSections)
|
|
596
|
+
? usage.promptSections.map((section) => ({
|
|
597
|
+
name: cleanText(section.name, 120),
|
|
598
|
+
tokenEstimate: Math.max(0, Number(section.tokenEstimate || 0) || 0)
|
|
599
|
+
})).filter((section) => section.name)
|
|
600
|
+
: [],
|
|
601
|
+
recordedAt: isoNow()
|
|
602
|
+
};
|
|
603
|
+
const ledger = (bundle.supportV5MicrotaskLedger || []).map((task) => task.microtaskId === record.microtaskId
|
|
604
|
+
? {
|
|
605
|
+
...task,
|
|
606
|
+
promptTokenEstimate: record.promptTokenEstimate,
|
|
607
|
+
updatedAt: record.recordedAt
|
|
608
|
+
}
|
|
609
|
+
: task);
|
|
610
|
+
return {
|
|
611
|
+
...bundle,
|
|
612
|
+
supportV5MicrotaskLedger: ledger,
|
|
613
|
+
supportV5MicrotaskUsageHistory: [
|
|
614
|
+
...(bundle.supportV5MicrotaskUsageHistory || []),
|
|
615
|
+
record
|
|
616
|
+
].slice(-200)
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
export function decideResolveIOSupportV5Continuation(bundle: ResolveIOSupportV5StateBundle): ResolveIOSupportV5ContinuationDecision {
|
|
621
|
+
const history = bundle.supportV5StepHistory || [];
|
|
622
|
+
const budget = buildResolveIOSupportV5Budget(bundle.supportV5Budget);
|
|
623
|
+
const last = history[history.length - 1];
|
|
624
|
+
const activeMicrotaskId = cleanText(bundle.supportV5ActiveMicrotaskId, 160);
|
|
625
|
+
const blockerFingerprint = fingerprintResolveIOSupportV5Blocker(last?.blocker || last?.summary || '');
|
|
626
|
+
let repeatedNoProgressCount = 0;
|
|
627
|
+
for (let index = history.length - 1; index >= 0; index -= 1) {
|
|
628
|
+
const item = history[index];
|
|
629
|
+
if (activeMicrotaskId && cleanText((item as any).microtaskId, 160) !== activeMicrotaskId) {
|
|
630
|
+
continue;
|
|
631
|
+
}
|
|
632
|
+
if (item.outcome === 'pass' || item.outcome === 'ready_for_merge') {
|
|
633
|
+
break;
|
|
634
|
+
}
|
|
635
|
+
if (item.stepType !== last?.stepType) {
|
|
636
|
+
break;
|
|
637
|
+
}
|
|
638
|
+
if (fingerprintResolveIOSupportV5Blocker(item.blocker || item.summary || '') === blockerFingerprint) {
|
|
639
|
+
repeatedNoProgressCount += 1;
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
const budgetExceeded = budget.loopCount >= budget.maxLoopsPerTicket
|
|
643
|
+
|| (last?.promptTokenEstimate || 0) > budget.maxPromptTokensPerNonInitialStep;
|
|
644
|
+
if (budgetExceeded) {
|
|
645
|
+
return {
|
|
646
|
+
action: 'park',
|
|
647
|
+
reason: 'support_v5_budget_guard',
|
|
648
|
+
nextStep: last?.stepType || 'cleanup',
|
|
649
|
+
repeatedNoProgressCount,
|
|
650
|
+
budgetExceeded
|
|
651
|
+
};
|
|
652
|
+
}
|
|
653
|
+
if (repeatedNoProgressCount > budget.maxRepeatedNoProgress) {
|
|
654
|
+
return {
|
|
655
|
+
action: 'park',
|
|
656
|
+
reason: 'support_v5_repeated_no_progress',
|
|
657
|
+
nextStep: last?.stepType || 'cleanup',
|
|
658
|
+
repeatedNoProgressCount,
|
|
659
|
+
budgetExceeded
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
return {
|
|
663
|
+
action: 'continue',
|
|
664
|
+
reason: 'support_v5_continue',
|
|
665
|
+
nextStep: last?.stepType || bundle.supportV5SupervisorState.activeStep,
|
|
666
|
+
repeatedNoProgressCount,
|
|
667
|
+
budgetExceeded: false
|
|
668
|
+
};
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
export function buildResolveIOSupportV5DiagnoseFirstPrompt(lines: {
|
|
672
|
+
goal?: string;
|
|
673
|
+
approvedScope?: string[];
|
|
674
|
+
activeStep?: ResolveIOSupportV5StepType;
|
|
675
|
+
activeBlocker?: string;
|
|
676
|
+
lane?: ResolveIOSupportV5Lane;
|
|
677
|
+
laneSummary?: string;
|
|
678
|
+
currentQaRow?: ResolveIOSupportV5LaneMemory['activeQaRow'];
|
|
679
|
+
artifactPaths?: string[];
|
|
680
|
+
changedFiles?: string[];
|
|
681
|
+
}): string[] {
|
|
682
|
+
return [
|
|
683
|
+
'Support Runner V5 contract: act like a guarded autonomous engineer, not a gate checklist.',
|
|
684
|
+
'Start with Diagnose First: observed evidence, likely cause, smallest next action, and expected proof.',
|
|
685
|
+
'Use compact lane memory and current artifacts before asking for broad ticket context.',
|
|
686
|
+
'Do not send customer email. Do not write production data. Do not spawn duplicate build, QA, server, client, Mongo, browser, or Codex processes.',
|
|
687
|
+
'If repairing, inspect logs/artifacts/source/diff first; make the smallest code or localhost-data change, then run the smallest finite self-gate.',
|
|
688
|
+
'For build repairs, prefer `npm run build-prod -- --watch=false`, a targeted `tsc --noEmit`, or a focused unit test. `npm run build-dev` is forbidden for support microtasks because it is slow/watch-oriented and can leave heavy esbuild work. If no finite gate exists, return a blocked self-gate with the exact reason instead of running build-dev.',
|
|
689
|
+
'If QA fails, retest the failed row before advancing; if the same blocker repeats without new proof, park with the exact blocker.',
|
|
690
|
+
lines.goal ? `Goal: ${cleanText(lines.goal, 500)}` : '',
|
|
691
|
+
cleanList(lines.approvedScope, 12, 240).length ? `Approved scope: ${cleanList(lines.approvedScope, 12, 240).join(' | ')}` : '',
|
|
692
|
+
lines.activeStep ? `Active step: ${lines.activeStep}` : '',
|
|
693
|
+
lines.lane ? `Lane: ${lines.lane}` : '',
|
|
694
|
+
lines.laneSummary ? `Lane memory: ${cleanText(lines.laneSummary, 700)}` : '',
|
|
695
|
+
lines.activeBlocker ? `Active blocker: ${cleanText(lines.activeBlocker, 800)}` : '',
|
|
696
|
+
lines.currentQaRow?.workflow ? `Current QA row: ${cleanText(lines.currentQaRow.workflow, 300)}` : '',
|
|
697
|
+
lines.currentQaRow?.route ? `Current QA route: ${cleanText(lines.currentQaRow.route, 300)}` : '',
|
|
698
|
+
cleanList(lines.changedFiles, 12, 200).length ? `Changed files: ${cleanList(lines.changedFiles, 12, 200).join(', ')}` : '',
|
|
699
|
+
cleanList(lines.artifactPaths, 12, 240).length ? `Artifacts: ${cleanList(lines.artifactPaths, 12, 240).join(', ')}` : ''
|
|
700
|
+
].filter(Boolean);
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
export function buildResolveIOSupportV5MicrotaskPrompt(input: {
|
|
704
|
+
bundle: ResolveIOSupportV5StateBundle;
|
|
705
|
+
lane: 'build' | 'qa';
|
|
706
|
+
model?: string;
|
|
707
|
+
stage?: string;
|
|
708
|
+
failureText?: string;
|
|
709
|
+
changedFiles?: string[];
|
|
710
|
+
artifactPaths?: string[];
|
|
711
|
+
targetFiles?: string[];
|
|
712
|
+
contextSnippets?: string[];
|
|
713
|
+
activeQaRow?: ResolveIOSupportV5LaneMemory['activeQaRow'];
|
|
714
|
+
}): {
|
|
715
|
+
prompt: string;
|
|
716
|
+
promptTokenEstimate: number;
|
|
717
|
+
promptSections: ResolveIOSupportV5UsageSection[];
|
|
718
|
+
activeMicrotask?: ResolveIOSupportV5Microtask;
|
|
719
|
+
withinCap: boolean;
|
|
720
|
+
withinHardCap: boolean;
|
|
721
|
+
cap: number;
|
|
722
|
+
hardCap: number;
|
|
723
|
+
reason?: string;
|
|
724
|
+
} {
|
|
725
|
+
const activeMicrotask = selectResolveIOSupportV5ActiveMicrotask(
|
|
726
|
+
input.bundle.supportV5MicrotaskLedger || [],
|
|
727
|
+
input.bundle.supportV5ActiveMicrotaskId
|
|
728
|
+
);
|
|
729
|
+
const budget = buildResolveIOSupportV5PromptBudget();
|
|
730
|
+
const repairLike = Boolean(input.failureText || activeMicrotask?.status === 'needs_repair' || /repair/i.test(String(input.stage || activeMicrotask?.type || '')));
|
|
731
|
+
const cap = repairLike
|
|
732
|
+
? budget.repairMicrotaskCap
|
|
733
|
+
: input.lane === 'qa'
|
|
734
|
+
? budget.qaMicrotaskCap
|
|
735
|
+
: budget.buildMicrotaskCap;
|
|
736
|
+
const hardCap = repairLike
|
|
737
|
+
? budget.repairMicrotaskHardCap
|
|
738
|
+
: input.lane === 'qa'
|
|
739
|
+
? budget.qaMicrotaskHardCap
|
|
740
|
+
: budget.buildMicrotaskHardCap;
|
|
741
|
+
const laneMemory = input.bundle.supportV5LaneMemory[input.lane];
|
|
742
|
+
const taskThreadKey = activeMicrotask?.threadKey || laneMemory.threadKey;
|
|
743
|
+
const changedFiles = cleanList(input.changedFiles?.length ? input.changedFiles : laneMemory.changedFiles, 8, 160);
|
|
744
|
+
const artifactPaths = cleanList(input.artifactPaths?.length ? input.artifactPaths : laneMemory.artifactPaths, 8, 200);
|
|
745
|
+
const targetFiles = cleanList(input.targetFiles?.length ? input.targetFiles : activeMicrotask?.targetFiles, 5, 160);
|
|
746
|
+
const contextSnippets = cleanList(input.contextSnippets, 5, 360);
|
|
747
|
+
const qaRow = input.activeQaRow || activeMicrotask?.lane === 'qa' ? input.activeQaRow || laneMemory.activeQaRow || input.bundle.supportV5SupervisorState.currentQaRow : undefined;
|
|
748
|
+
const sections = [
|
|
749
|
+
{
|
|
750
|
+
name: 'microtask_contract',
|
|
751
|
+
text: [
|
|
752
|
+
'Support Runner V5 Microtask Contract.',
|
|
753
|
+
'Use the existing persistent lane thread. Do not start a fresh thread.',
|
|
754
|
+
'Do exactly one microtask and one proof gate. Do not replay ticket triage, prior plans, attachments, broad QA checklist, or unrelated scope.',
|
|
755
|
+
'If context is insufficient, request the smallest missing file/log/artifact by path and park this microtask; do not broaden the prompt.',
|
|
756
|
+
'Do not send customer email. Do not deploy. Do not spawn duplicate server/client/Mongo/browser/Codex processes.',
|
|
757
|
+
input.lane === 'qa'
|
|
758
|
+
? 'QA lane hard boundary: the platform preflight owns compile, dependency install, Mongo/server/client startup, and Angular startup. This lane owns only browser/data proof and QA artifacts unless the prompt explicitly says preflight was skipped.'
|
|
759
|
+
: 'Build lane hard boundary: do not run `npm run build-dev`, `ng build`, `npm run server`, `npm run client`, `ng serve`, `run-local-qa.sh`, browser automation, or any watch/long-lived command. If a broad compile gate is needed, run only `npm run build-prod -- --watch=false`; otherwise use a targeted finite check or return the precise blocker.'
|
|
760
|
+
].join('\n')
|
|
761
|
+
},
|
|
762
|
+
{
|
|
763
|
+
name: 'scope_digest',
|
|
764
|
+
text: cleanText(input.bundle.supportV5ScopeDigest || input.bundle.supportV5SupervisorState.approvedScope, 900)
|
|
765
|
+
},
|
|
766
|
+
{
|
|
767
|
+
name: 'active_microtask',
|
|
768
|
+
text: activeMicrotask ? [
|
|
769
|
+
`Microtask id: ${activeMicrotask.microtaskId}`,
|
|
770
|
+
`Lane: ${input.lane}`,
|
|
771
|
+
`Type: ${activeMicrotask.type}`,
|
|
772
|
+
`Status: ${activeMicrotask.status}`,
|
|
773
|
+
`Objective: ${cleanText(activeMicrotask.objective, 360)}`,
|
|
774
|
+
`Self-gate: ${cleanText(activeMicrotask.selfGate, 260)}`,
|
|
775
|
+
`Acceptance proof: ${cleanText(activeMicrotask.acceptanceProof, 260)}`,
|
|
776
|
+
`Attempts on this microtask: ${activeMicrotask.attempts}`,
|
|
777
|
+
`Thread key: ${taskThreadKey}`
|
|
778
|
+
].join('\n') : 'No active microtask found. Park and report support_v5_microtask_missing.'
|
|
779
|
+
},
|
|
780
|
+
{
|
|
781
|
+
name: 'failure_delta',
|
|
782
|
+
text: input.failureText ? `Latest blocker/failure delta: ${cleanText(input.failureText, 700)}` : ''
|
|
783
|
+
},
|
|
784
|
+
{
|
|
785
|
+
name: 'target_context',
|
|
786
|
+
text: [
|
|
787
|
+
targetFiles.length ? `Target files: ${targetFiles.join(', ')}` : '',
|
|
788
|
+
changedFiles.length ? `Changed files: ${changedFiles.join(', ')}` : '',
|
|
789
|
+
artifactPaths.length ? `Artifacts: ${artifactPaths.join(', ')}` : '',
|
|
790
|
+
qaRow?.workflow ? `QA row workflow: ${cleanText(qaRow.workflow, 220)}` : '',
|
|
791
|
+
qaRow?.route ? `QA row route: ${cleanText(qaRow.route, 220)}` : '',
|
|
792
|
+
qaRow?.assertion ? `QA row assertion: ${cleanText(qaRow.assertion, 260)}` : '',
|
|
793
|
+
contextSnippets.length ? `Relevant snippets:\n${contextSnippets.join('\n---\n')}` : ''
|
|
794
|
+
].filter(Boolean).join('\n')
|
|
795
|
+
},
|
|
796
|
+
input.lane === 'qa' ? {
|
|
797
|
+
name: 'qa_browser_evidence_contract',
|
|
798
|
+
text: [
|
|
799
|
+
'QA lane first action after preflight: collect fresh browser evidence for the active row, not a proof review of existing route/auth artifacts.',
|
|
800
|
+
'Use the already-running localhost harness and staged env. Before any shell command, run `source .resolveio-support-tools/env.sh 2>/dev/null || source ../.resolveio-support-tools/env.sh 2>/dev/null || true`; then use `$RESOLVEIO_SUPPORT_QA_CLIENT_URL`, `$RESOLVEIO_SUPPORT_QA_SERVER_URL`, `$PUPPETEER_EXECUTABLE_PATH`, and `$CHROME_BIN`.',
|
|
801
|
+
'Required auth replay helper inside every Puppeteer row script: `const storage=JSON.parse(fs.readFileSync("qa-artifacts/auth-bootstrap-storage-state.json","utf8")); const entries=[...(Array.isArray(storage.localStorageEntries)?storage.localStorageEntries:[]), ...(Array.isArray(storage.localStorage)?storage.localStorage:Object.entries(storage.localStorage||{}).map(([key,value])=>({key,value}))), ...((storage.origins||[]).flatMap(o=>o.localStorage||[]))].map(e=>({key:e.key||e.name,value:e.value})).filter(e=>e.key); const clientUrl=process.env.RESOLVEIO_SUPPORT_QA_CLIENT_URL||process.env.RESOLVEIO_RUNNER_QA_CLIENT_URL; const rowRoute="<ACTIVE_QA_ROUTE>"; await page.goto(clientUrl,{waitUntil:"domcontentloaded"}); await page.evaluate(items=>{localStorage.clear(); for(const item of items)localStorage.setItem(item.key,item.value);}, entries); await page.goto(new URL(rowRoute, clientUrl).href,{waitUntil:"domcontentloaded"});` Replace `<ACTIVE_QA_ROUTE>` with the active row route before running. A screenshot of `/home`, the login screen, or a shell route after this helper means the QA script navigated to the wrong route or storage is stale; rerun the same row with the active route before returning an app blocker.',
|
|
802
|
+
'Allowed first command shape: one bounded `node`/Puppeteer row script that reads `qa-artifacts/auth-bootstrap-storage-state.json`, opens `$RESOLVEIO_SUPPORT_QA_CLIENT_URL`, seeds localStorage, navigates to the active QA route with `new URL(activeRoute, clientUrl).href`, drives the visible workflow, captures screenshot/caption, and updates the active matrix row. A `/home` proof is invalid for a locked non-home route.',
|
|
803
|
+
'Forbidden in QA lane after preflight: `npm run build`, `npm run build-dev`, `npm run build-prod`, `ng build`, `npm install`, `npm ci`, `npm run server`, `npm run client`, `ng serve`, `gulp`, `mongod`, `run-local-qa.sh`, and broad source discovery. If a build/startup/dependency problem is suspected, return `blocked` or `needs-fix` with the existing qa-artifacts log paths instead of launching those commands.',
|
|
804
|
+
'Launch Puppeteer from `PUPPETEER_EXECUTABLE_PATH || CHROME_BIN`, seed localStorage from `qa-artifacts/auth-bootstrap-storage-state.json`, then navigate to the active QA route.',
|
|
805
|
+
'Before passing, confirm `qa-artifacts/auth-bootstrap-result.json` used the ticket reporter or named affected user when available. If it used generic admin/dev while `qa-live-data-seed-result.json.selected.qa_user_context` names a reporter/affected user, rerun auth as that user or return needs-fix.',
|
|
806
|
+
'Drive the visible customer workflow for this one row. Capture a new customer-facing screenshot/caption and update `qa-artifacts/qa-coverage-matrix.json` with workflow, route, data id/name, assertion, screenshot path, caption, and pass/failed/blocked status.',
|
|
807
|
+
'After selecting any From/To, source/target, dropdown, combobox, rio-select, filter, item, customer, yard, chemical, or treatment-plan value, read the visible control text back from the DOM. If it still contains placeholder text such as Select Chemical, Select Yard, Select Customer, Select Treatment Plan Type, Loading..., empty, null, or undefined, do not click the action button and do not mark pass. Capture the selected-state blocker screenshot/DOM text and return needs-fix.',
|
|
808
|
+
'If the row needs persisted data proof, create that proof yourself in the same bounded QA command by querying localhost QA Mongo through process.env.MONGO_URL after the visible UI action. Write the result under qa-artifacts/ as JSON and reference that path in the matrix. Do not ask for a missing post-action DB artifact while the local QA stack is running; either write it or return needs-fix with the exact query/script error. For update-interchangeables rows, the JSON must include concrete non-placeholder fromText and toText, before/after counts or sample documents for treatment plans and tank/interchangeable records, and must fail if either selected value is only an arrow/placeholder or if the persisted collections are empty.',
|
|
809
|
+
'If the row names multiple concrete entities such as assets, units, BOLs, invoices, chemicals, customers, yards, or numbered records, prove every named entity. Do not pass by proving only one representative record.',
|
|
810
|
+
'For customer-reported data bugs, use production-seeded localhost records from `qa-live-data-seed-result.json`. If the exact named record is missing from the seed, fail the row as a seed/query blocker instead of testing a substitute record.',
|
|
811
|
+
'Route-ready, auth-bootstrap, shell, header-only, and empty-list screenshots do not satisfy this microtask. If the row cannot be proven, capture the blocker screenshot/DOM state and return needs-fix with that exact blocker.',
|
|
812
|
+
'Do not run compile/startup/npm install, do not spawn another server/client/Mongo, and do not inspect broad source trees before the first browser evidence command.'
|
|
813
|
+
].join('\n')
|
|
814
|
+
} : {
|
|
815
|
+
name: 'non_qa_noop',
|
|
816
|
+
text: ''
|
|
817
|
+
},
|
|
818
|
+
{
|
|
819
|
+
name: 'return_contract',
|
|
820
|
+
text: input.lane === 'qa'
|
|
821
|
+
? 'Return strict JSON only: {"status":"pass"|"needs-fix"|"blocked","microtaskId":"","summary":"","evidence":[""],"artifacts":[""],"next_actions":[""]}.'
|
|
822
|
+
: 'Return concise Markdown with: Microtask Result, Root Cause, Changes, Self-Gate, Acceptance Proof, Residual Risk.'
|
|
823
|
+
}
|
|
824
|
+
].filter((section) => cleanText(section.text, 20));
|
|
825
|
+
const promptSections = sections.map((section) => ({
|
|
826
|
+
name: section.name,
|
|
827
|
+
tokenEstimate: estimateTextTokens(section.text)
|
|
828
|
+
}));
|
|
829
|
+
const prompt = sections.map((section) => section.text).join('\n\n');
|
|
830
|
+
const promptTokenEstimate = estimateTextTokens(prompt);
|
|
831
|
+
return {
|
|
832
|
+
prompt,
|
|
833
|
+
promptTokenEstimate,
|
|
834
|
+
promptSections,
|
|
835
|
+
activeMicrotask,
|
|
836
|
+
withinCap: promptTokenEstimate <= cap,
|
|
837
|
+
withinHardCap: promptTokenEstimate <= hardCap,
|
|
838
|
+
cap,
|
|
839
|
+
hardCap,
|
|
840
|
+
reason: promptTokenEstimate > hardCap
|
|
841
|
+
? 'support_v5_microtask_prompt_hard_cap'
|
|
842
|
+
: promptTokenEstimate > cap
|
|
843
|
+
? 'support_v5_microtask_prompt_soft_cap'
|
|
844
|
+
: undefined
|
|
845
|
+
};
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
export function summarizeResolveIOSupportV5MicrotaskUsage(bundle: ResolveIOSupportV5StateBundle): {
|
|
849
|
+
totalPromptTokenEstimate: number;
|
|
850
|
+
byMicrotask: Array<{ microtaskId: string; promptTokenEstimate: number; calls: number }>;
|
|
851
|
+
bySection: ResolveIOSupportV5UsageSection[];
|
|
852
|
+
broadPromptViolations: ResolveIOSupportV5MicrotaskUsage[];
|
|
853
|
+
} {
|
|
854
|
+
const byMicrotask = new Map<string, { microtaskId: string; promptTokenEstimate: number; calls: number }>();
|
|
855
|
+
const bySection = new Map<string, number>();
|
|
856
|
+
let totalPromptTokenEstimate = 0;
|
|
857
|
+
const broadPromptViolations: ResolveIOSupportV5MicrotaskUsage[] = [];
|
|
858
|
+
const promptBudget = buildResolveIOSupportV5PromptBudget();
|
|
859
|
+
for (const usage of bundle.supportV5MicrotaskUsageHistory || []) {
|
|
860
|
+
totalPromptTokenEstimate += usage.promptTokenEstimate || 0;
|
|
861
|
+
const existing = byMicrotask.get(usage.microtaskId) || { microtaskId: usage.microtaskId, promptTokenEstimate: 0, calls: 0 };
|
|
862
|
+
existing.promptTokenEstimate += usage.promptTokenEstimate || 0;
|
|
863
|
+
existing.calls += 1;
|
|
864
|
+
byMicrotask.set(usage.microtaskId, existing);
|
|
865
|
+
for (const section of usage.promptSections || []) {
|
|
866
|
+
bySection.set(section.name, (bySection.get(section.name) || 0) + section.tokenEstimate);
|
|
867
|
+
}
|
|
868
|
+
const hardCap = usage.lane === 'qa' ? promptBudget.qaMicrotaskHardCap : promptBudget.buildMicrotaskHardCap;
|
|
869
|
+
if ((usage.promptTokenEstimate || 0) > hardCap) {
|
|
870
|
+
broadPromptViolations.push(usage);
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
return {
|
|
874
|
+
totalPromptTokenEstimate,
|
|
875
|
+
byMicrotask: Array.from(byMicrotask.values()),
|
|
876
|
+
bySection: Array.from(bySection.entries()).map(([name, tokenEstimate]) => ({ name, tokenEstimate })),
|
|
877
|
+
broadPromptViolations
|
|
878
|
+
};
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
export function buildResolveIOSupportV5Incident(input: {
|
|
882
|
+
incidentClass: string;
|
|
883
|
+
summary: string;
|
|
884
|
+
stepType?: ResolveIOSupportV5StepType;
|
|
885
|
+
blocker?: string;
|
|
886
|
+
artifactPaths?: string[];
|
|
887
|
+
now?: Date | string;
|
|
888
|
+
}): ResolveIOSupportV5RunnerIncident {
|
|
889
|
+
return {
|
|
890
|
+
incidentClass: cleanText(input.incidentClass, 120) || 'support_v5_runner_incident',
|
|
891
|
+
summary: cleanText(input.summary, 1200),
|
|
892
|
+
stepType: input.stepType,
|
|
893
|
+
blockerFingerprint: input.blocker ? fingerprintResolveIOSupportV5Blocker(input.blocker) : undefined,
|
|
894
|
+
artifactPaths: cleanList(input.artifactPaths, 40, 500),
|
|
895
|
+
recordedAt: isoNow(input.now)
|
|
896
|
+
};
|
|
897
|
+
}
|