verify-lobster-changes.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. #!/usr/bin/env node
  2. /**
  3. * Static verification for lobster execution / prompt unification changes.
  4. * Run: node saas-adminui/scripts/verify-lobster-changes.js
  5. */
  6. const fs = require('fs');
  7. const path = require('path');
  8. const root = path.resolve(__dirname, '../..');
  9. const checks = [];
  10. function read(rel) {
  11. return fs.readFileSync(path.join(root, rel), 'utf8');
  12. }
  13. function ok(name, pass, detail) {
  14. checks.push({ name, pass, detail: detail || '' });
  15. }
  16. function includes(rel, needle, label) {
  17. const content = read(rel);
  18. ok(label || `${rel} contains ${needle}`, content.includes(needle));
  19. }
  20. function notIncludes(rel, needle, label) {
  21. const content = read(rel);
  22. ok(label || `${rel} excludes ${needle}`, !content.includes(needle));
  23. }
  24. // --- Prompt workflowCode ---
  25. includes(
  26. 'java/fs-service/src/main/java/com/fs/company/service/workflow/impl/LobsterWorkflowExecutorImpl.java',
  27. 'resolveWorkflowCodeForNode',
  28. 'Executor resolves templateCode for prompts'
  29. );
  30. includes(
  31. 'java/fs-service/src/main/java/com/fs/company/service/workflow/impl/LobsterEvolutionEngineImpl.java',
  32. 'workflowPromptResolver.resolveWorkflowCodeByInstanceId',
  33. 'Evolution engine uses workflowPromptResolver'
  34. );
  35. includes(
  36. 'java/fs-service/src/main/resources/mapper/company/LobsterSystemPromptMapper.xml',
  37. 'ORDER BY',
  38. 'Prompt selectByPriority has priority ordering'
  39. );
  40. // --- PROMPT fallback ---
  41. includes(
  42. 'java/fs-service/src/main/java/com/fs/company/service/workflow/execution/LobsterInboundPromptReplyService.java',
  43. 'generateReply',
  44. 'Inbound prompt reply service exists'
  45. );
  46. includes(
  47. 'java/fs-service/src/main/java/com/fs/company/service/workflow/execution/LobsterInboundReplyOrchestrator.java',
  48. 'replyViaPromptFallback',
  49. 'Orchestrator uses prompt fallback'
  50. );
  51. // --- Tag binding ---
  52. includes(
  53. 'java/fs-service/src/main/java/com/fs/company/service/impl/CompanyTagTemplateBindingServiceImpl.java',
  54. 'evaluateMatchCondition(b.getMatchCondition(), userTags)',
  55. 'matchTemplate filters by matchCondition'
  56. );
  57. includes(
  58. 'java/fs-service/src/main/resources/mapper/company/CompanyLobsterTagUserRelMapper.xml',
  59. 'selectLobsterTagsByContactIds',
  60. 'Multi-channel lobster tag query'
  61. );
  62. includes(
  63. 'java/fs-service/src/main/resources/mapper/company/LobsterWorkflowInstanceMapper.xml',
  64. 'selectByBindingId',
  65. 'Binding instance SQL filter'
  66. );
  67. // --- Frontend ---
  68. includes(
  69. 'saas-companyui/src/views/company/companyClient/index.vue',
  70. 'lobsterTagNames',
  71. 'WX client list shows lobster tags'
  72. );
  73. includes(
  74. 'java/fs-service/src/main/java/com/fs/company/service/workflow/impl/NodePromptServiceImpl.java',
  75. 'saveNodePromptPair',
  76. 'Canvas prompt dual-write helper'
  77. );
  78. // --- AI chat node ---
  79. includes(
  80. 'java/fs-service/src/main/java/com/fs/company/service/workflow/impl/DynamicNodeExecutorImpl.java',
  81. 'resolveAiChatSystemPrompt',
  82. 'AI chat node uses PromptManager'
  83. );
  84. // --- Migration ---
  85. includes(
  86. 'java/sql/V20260617_01__lobster_execution_unify.sql',
  87. 'binding_id',
  88. 'Execution unify migration exists'
  89. );
  90. // --- Hook PROMPT with content ---
  91. includes(
  92. 'java/fs-service/src/main/java/com/fs/fastGpt/service/impl/AiHookServiceImpl.java',
  93. 'QW prompt route unified reply',
  94. 'QW hook sends unified PROMPT reply'
  95. );
  96. const failed = checks.filter(c => !c.pass);
  97. console.log('Lobster change verification');
  98. console.log('='.repeat(50));
  99. checks.forEach(c => {
  100. console.log(`${c.pass ? 'PASS' : 'FAIL'} ${c.name}${c.detail ? ' ?? ' + c.detail : ''}`);
  101. });
  102. console.log('='.repeat(50));
  103. console.log(`Total: ${checks.length}, Passed: ${checks.length - failed.length}, Failed: ${failed.length}`);
  104. process.exit(failed.length ? 1 : 0);