新增市場情報 report catalog record run package gate
All checks were successful
CD Pipeline / deploy (push) Successful in 1m4s

This commit is contained in:
OoO
2026-05-20 19:36:42 +08:00
parent 8edd8a8604
commit e506251194
9 changed files with 1213 additions and 106 deletions

View File

@@ -760,6 +760,9 @@
<button class="market-intel-icon-button" type="button" title="檢查 queue review AI summary Telegram dispatch report catalog record write gate" data-market-intel-sample-candidate-queue-review-ai-summary-persistence-telegram-dispatch-report-catalog-record-write>
<i class="fas fa-database" aria-hidden="true"></i>
</button>
<button class="market-intel-icon-button" type="button" title="產生 queue review AI summary Telegram dispatch report catalog record run package" data-market-intel-sample-candidate-queue-review-ai-summary-persistence-telegram-dispatch-report-catalog-record-run-package>
<i class="fas fa-box" aria-hidden="true"></i>
</button>
</div>
</div>
</div>
@@ -1141,6 +1144,7 @@
const sampleCandidateQueueReviewAiSummaryPersistenceTelegramDispatchReportCatalogIndex = sampleReviewRoot ? sampleReviewRoot.querySelector('[data-market-intel-sample-candidate-queue-review-ai-summary-persistence-telegram-dispatch-report-catalog-index]') : null;
const sampleCandidateQueueReviewAiSummaryPersistenceTelegramDispatchReportCatalogWritePreflight = sampleReviewRoot ? sampleReviewRoot.querySelector('[data-market-intel-sample-candidate-queue-review-ai-summary-persistence-telegram-dispatch-report-catalog-write-preflight]') : null;
const sampleCandidateQueueReviewAiSummaryPersistenceTelegramDispatchReportCatalogRecordWrite = sampleReviewRoot ? sampleReviewRoot.querySelector('[data-market-intel-sample-candidate-queue-review-ai-summary-persistence-telegram-dispatch-report-catalog-record-write]') : null;
const sampleCandidateQueueReviewAiSummaryPersistenceTelegramDispatchReportCatalogRecordRunPackage = sampleReviewRoot ? sampleReviewRoot.querySelector('[data-market-intel-sample-candidate-queue-review-ai-summary-persistence-telegram-dispatch-report-catalog-record-run-package]') : null;
const sampleReviewEndpoint = "{{ url_for('market_intel.market_intel_manual_sample_review') }}";
const sampleReviewEvaluateEndpoint = "{{ url_for('market_intel.market_intel_manual_sample_review_evaluate') }}";
const sampleCandidateHandoffEndpoint = "{{ url_for('market_intel.market_intel_manual_sample_candidate_handoff') }}";
@@ -1199,6 +1203,7 @@
const sampleCandidateQueueReviewAiSummaryPersistenceTelegramDispatchReportCatalogIndexEndpoint = "{{ url_for('market_intel_review.market_intel_manual_sample_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_index') }}";
const sampleCandidateQueueReviewAiSummaryPersistenceTelegramDispatchReportCatalogWritePreflightEndpoint = "{{ url_for('market_intel_review.market_intel_manual_sample_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_write_preflight') }}";
const sampleCandidateQueueReviewAiSummaryPersistenceTelegramDispatchReportCatalogRecordWriteEndpoint = "{{ url_for('market_intel_review.market_intel_manual_sample_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_write') }}";
const sampleCandidateQueueReviewAiSummaryPersistenceTelegramDispatchReportCatalogRecordRunPackageEndpoint = "{{ url_for('market_intel_review.market_intel_manual_sample_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_run_package') }}";
const schedulerMeta = schedulerRoot ? schedulerRoot.querySelector('[data-market-intel-scheduler-meta]') : null;
const schedulerBody = schedulerRoot ? schedulerRoot.querySelector('[data-market-intel-scheduler-body]') : null;
const schedulerRefresh = schedulerRoot ? schedulerRoot.querySelector('[data-market-intel-scheduler-refresh]') : null;
@@ -8576,6 +8581,144 @@
}
};
const renderCandidateQueueReviewAiSummaryPersistenceTelegramDispatchReportCatalogRecordRunPackage = data => {
const blockers = (data.blocked_reasons || []).join(' / ');
const gates = data.gates || [];
const recordWrite = data.telegram_dispatch_report_catalog_record_write || {};
const operator = data.operator_telegram_dispatch_report_catalog_record_run_package || {};
const sections = data.telegram_dispatch_report_catalog_record_run_package_sections || [];
const command = data.command_bundle || {};
const manifest = data.payload_manifest || {};
const promotion = data.promotion_gate || {};
sampleReviewMeta.innerHTML = [
`mode=${data.mode || 'unknown'}`,
`run_package=${data.telegram_dispatch_report_catalog_record_run_package_passed ? 'pass' : 'blocked'}`,
`readiness=${data.ready_for_market_intel_report_catalog_record_run_readiness ? 'ready' : 'blocked'}`,
`cli=${data.catalog_record_cli_executed ? 'executed' : 'blocked'}`,
`db=${data.database_write_executed ? 'written' : 'blocked'}`
].map(item => `<span class="market-intel-pill">${escapeHtml(item)}</span>`).join('');
sampleReviewBody.innerHTML = `
<div class="market-intel-empty mb-3">此卡只產生 Telegram dispatch report catalog record run package 預覽API/UI 不讀 token、不寫檔、不執行 CLI、不開 DB、不寫 catalog record、不掛 scheduler。${blockers ? `阻擋:${escapeHtml(blockers)}` : ''}</div>
<div class="market-intel-deploy-grid">
<div>
<p class="market-intel-deploy-section-title">RUN PACKAGE GATES</p>
<div class="market-intel-check-list">${
gates.map(item => `
<div class="market-intel-check">
<div>
<strong>${escapeHtml(item.key)}</strong>
<small>${escapeHtml(item.label)}</small>
</div>
<span>${item.passed ? 'PASS' : 'BLOCK'}</span>
</div>
`).join('') || '<div class="market-intel-empty">尚未提供 run package gate。</div>'
}</div>
</div>
<div>
<p class="market-intel-deploy-section-title">RUN PACKAGE SECTIONS</p>
<div class="market-intel-check-list">${
sections.map(item => `
<div class="market-intel-check">
<div>
<strong>${escapeHtml(item.key)}</strong>
<small>${escapeHtml((item.facts || []).join(' / '))}</small>
</div>
<span>READY</span>
</div>
`).join('') || '<div class="market-intel-empty">尚未提供 run package sections。</div>'
}</div>
</div>
<div>
<p class="market-intel-deploy-section-title">RECORD WRITE</p>
<div class="market-intel-check-list">
${[
['provided', recordWrite.provided],
['mode', recordWrite.mode || 'missing'],
['record_write_passed', recordWrite.catalog_record_write_passed],
['cli_ready', recordWrite.ready_for_market_intel_report_catalog_record_cli_run],
['report_family', recordWrite.target_report_family || 'missing'],
['report_hash', recordWrite.report_output_hash || 'missing'],
['dry_run', recordWrite.catalog_record_write_dry_run_artifact_path_recorded]
].map(([key, value]) => `
<div class="market-intel-check">
<div><strong>${escapeHtml(key)}</strong></div>
<span>${escapeHtml(String(value))}</span>
</div>
`).join('')}
</div>
</div>
<div>
<p class="market-intel-deploy-section-title">PACKAGE INPUT</p>
<div class="market-intel-check-list">
${[
['package_path', operator.report_catalog_record_run_package_artifact_path || 'missing'],
['write_gate_path', operator.report_catalog_record_write_artifact_path_recorded],
['manifest_path', operator.catalog_record_payload_manifest_path_recorded],
['backup', operator.catalog_record_backup_artifact_path_recorded],
['dry_run', operator.catalog_record_write_dry_run_artifact_path_recorded],
['cli_command', operator.catalog_record_cli_command_recorded],
['runtime_clear', operator.operator_confirmed_no_token_in_report_catalog_record_run_package && operator.operator_confirmed_no_api_file_write && operator.operator_confirmed_no_api_catalog_record_write && operator.operator_confirmed_no_api_telegram_dispatch && operator.operator_confirmed_no_api_db_write && operator.operator_confirmed_no_llm_call && operator.operator_confirmed_no_scheduler_attach]
].map(([key, value]) => `
<div class="market-intel-check">
<div><strong>${escapeHtml(key)}</strong></div>
<span>${escapeHtml(String(value))}</span>
</div>
`).join('')}
</div>
</div>
<div>
<p class="market-intel-deploy-section-title">COMMAND / PROMOTION</p>
<div class="market-intel-check-list">
${[
['script', command.script_path || 'missing'],
['api_must_not_execute', command.api_must_not_execute_command],
['manifest_execute_in_api', manifest.execute_in_api],
['next_phase', promotion.next_manual_phase || 'missing'],
['run_readiness_gate', promotion.report_catalog_record_run_readiness_requires_separate_gate],
['commit_gate', promotion.report_catalog_record_commit_requires_separate_gate]
].map(([key, value]) => `
<div class="market-intel-check">
<div><strong>${escapeHtml(key)}</strong></div>
<span>${escapeHtml(String(value))}</span>
</div>
`).join('')}
</div>
</div>
</div>
`;
};
const loadCandidateQueueReviewAiSummaryPersistenceTelegramDispatchReportCatalogRecordRunPackage = async () => {
if (!sampleReviewMeta || !sampleReviewBody || !sampleReviewInput) return;
let parsed;
try {
parsed = JSON.parse(sampleReviewInput.value || '{}');
} catch (error) {
sampleReviewMeta.innerHTML = '<span class="market-intel-pill">json_error</span>';
sampleReviewBody.innerHTML = `<div class="market-intel-empty">JSON 格式錯誤:${escapeHtml(error.message)}</div>`;
return;
}
const body = parsed && parsed.sample_result ? parsed : { sample_result: parsed };
sampleReviewBody.innerHTML = '<div class="market-intel-empty">產生 queue review AI summary Telegram dispatch report catalog record run package 預覽中...</div>';
try {
const response = await fetch(`${sampleCandidateQueueReviewAiSummaryPersistenceTelegramDispatchReportCatalogRecordRunPackageEndpoint}?execute=false&apply_real_write=false`, {
method: 'POST',
credentials: 'same-origin',
headers: {
'Content-Type': 'application/json',
'X-CSRFToken': csrfToken
},
body: JSON.stringify(body)
});
const data = await response.json();
if (!response.ok && !data.mode) throw new Error(`HTTP ${response.status}`);
renderCandidateQueueReviewAiSummaryPersistenceTelegramDispatchReportCatalogRecordRunPackage(data);
} catch (error) {
sampleReviewMeta.innerHTML = '<span class="market-intel-pill">error</span>';
sampleReviewBody.innerHTML = `<div class="market-intel-empty">queue review AI summary Telegram dispatch report catalog record run package 失敗:${escapeHtml(error.message)}</div>`;
}
};
const renderCandidateQueueReviewDecisionWriter = data => {
const blockers = (data.blocked_reasons || []).join(' / ');
const summary = data.statement_summary || {};
@@ -10351,6 +10494,9 @@
if (sampleCandidateQueueReviewAiSummaryPersistenceTelegramDispatchReportCatalogRecordWrite) {
sampleCandidateQueueReviewAiSummaryPersistenceTelegramDispatchReportCatalogRecordWrite.addEventListener('click', loadCandidateQueueReviewAiSummaryPersistenceTelegramDispatchReportCatalogRecordWrite);
}
if (sampleCandidateQueueReviewAiSummaryPersistenceTelegramDispatchReportCatalogRecordRunPackage) {
sampleCandidateQueueReviewAiSummaryPersistenceTelegramDispatchReportCatalogRecordRunPackage.addEventListener('click', loadCandidateQueueReviewAiSummaryPersistenceTelegramDispatchReportCatalogRecordRunPackage);
}
if (schedulerRefresh) {
schedulerRefresh.addEventListener('click', loadScheduler);
}