fusesell 1.2.6__py3-none-any.whl → 1.2.7__py3-none-any.whl

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.

Potentially problematic release.


This version of fusesell might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fusesell
3
- Version: 1.2.6
3
+ Version: 1.2.7
4
4
  Summary: Local implementation of FuseSell AI sales automation pipeline
5
5
  Author-email: FuseSell Team <team@fusesell.ai>
6
6
  License-Expression: MIT
@@ -1,9 +1,9 @@
1
1
  fusesell.py,sha256=t5PjkhWEJGINp4k517u0EX0ge7lzuHOUHHro-BE1mGk,596
2
- fusesell-1.2.6.dist-info/licenses/LICENSE,sha256=GDz1ZoC4lB0kwjERpzqc_OdA_awYVso2aBnUH-ErW_w,1070
3
- fusesell_local/__init__.py,sha256=06b8-0tg3rF1k8Bb_XTASXJ3rgA3lIM8RgdXEDeaiCY,966
2
+ fusesell-1.2.7.dist-info/licenses/LICENSE,sha256=GDz1ZoC4lB0kwjERpzqc_OdA_awYVso2aBnUH-ErW_w,1070
3
+ fusesell_local/__init__.py,sha256=8U1jX2uHDz_7rJeLg7NGKJGJum7I8VK-RwZCtXxRVrs,966
4
4
  fusesell_local/api.py,sha256=AcPune5YJdgi7nsMeusCUqc49z5UiycsQb6n3yiV_No,10839
5
5
  fusesell_local/cli.py,sha256=MYnVxuEf5KTR4VcO3sc-VtP9NkWlSixJsYfOWST2Ds0,65859
6
- fusesell_local/pipeline.py,sha256=zhAy8dtfcfjmRFqW9Dxr5fCGuxqvejFrIrJFw7s7hVU,39664
6
+ fusesell_local/pipeline.py,sha256=RMF_kgwNEc1ka8-CDJyzIOTSo8PGtR_zPKAgRevhlNo,39913
7
7
  fusesell_local/config/__init__.py,sha256=0ErO7QiSDqKn-LHcjIRdLZzh5QaRTkRsIlwfgpkkDz8,209
8
8
  fusesell_local/config/prompts.py,sha256=5O3Y2v3GCi9d9FEyR6Ekc1UXVq2TcZp3Rrspvx4bkac,10164
9
9
  fusesell_local/config/settings.py,sha256=rbjGPLQTFFr7DiWrPnZDFaOSNsdEMMYFx6pn7b13xGs,10743
@@ -12,7 +12,7 @@ fusesell_local/stages/base_stage.py,sha256=ldo5xuHZto7ceEg3i_3rxAx0xPccK4n2jaxEJ
12
12
  fusesell_local/stages/data_acquisition.py,sha256=Td3mwakJRoEYbi3od4v2ZzKOHLgLSgccZVxH3ezs1_4,71081
13
13
  fusesell_local/stages/data_preparation.py,sha256=XWLg9b1w2NrMxLcrWDqB95mRmLQmVIMXpKNaBNr98TQ,52751
14
14
  fusesell_local/stages/follow_up.py,sha256=H9Xek6EoIbHrerQvGTRswXDNFH6zq71DcRxxj0zpo2g,77747
15
- fusesell_local/stages/initial_outreach.py,sha256=znokii7zEEOqgRWzOAeGwZxBLUyA7ks70zGN3uAiCDQ,114322
15
+ fusesell_local/stages/initial_outreach.py,sha256=U6KHZIpr7d-W3x65z9XVm0gKL88SaVR47-_cQq3f-dc,117170
16
16
  fusesell_local/stages/lead_scoring.py,sha256=ir3l849eMGrGLf0OYUcmA1F3FwyYhAplS4niU3R2GRY,60658
17
17
  fusesell_local/tests/conftest.py,sha256=TWUtlP6cNPVOYkTPz-j9BzS_KnXdPWy8D-ObPLHvXYs,366
18
18
  fusesell_local/tests/test_api.py,sha256=763rUVb5pAuAQOovug6Ka0T9eGK8-WVOC_J08M7TETo,1827
@@ -28,8 +28,8 @@ fusesell_local/utils/llm_client.py,sha256=FVc25UlGt6hro7h5Iw7PHSXY3E3_67Xc-SUbHu
28
28
  fusesell_local/utils/logger.py,sha256=sWlV8Tjyz_Z8J4zXKOnNalh8_iD6ytfrwPZpD-wcEOs,6259
29
29
  fusesell_local/utils/timezone_detector.py,sha256=0cAE4c8ZXqCA8AvxRKm6PrFKmAmsbq3HOHR6w-mW3KQ,39997
30
30
  fusesell_local/utils/validators.py,sha256=Z1VzeoxFsnuzlIA_ZaMWoy-0Cgyqupd47kIdljlMDbs,15438
31
- fusesell-1.2.6.dist-info/METADATA,sha256=1JvOPSQ0R602Oa0HoGfPVbQ4c1akfTDyc5rsevASgf8,35074
32
- fusesell-1.2.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
33
- fusesell-1.2.6.dist-info/entry_points.txt,sha256=Vqek7tbiX7iF4rQkCRBZvT5WrB0HUduqKTsI2ZjhsXo,53
34
- fusesell-1.2.6.dist-info/top_level.txt,sha256=VP9y1K6DEq6gNq2UgLd7ChujxViF6OzeAVCK7IUBXPA,24
35
- fusesell-1.2.6.dist-info/RECORD,,
31
+ fusesell-1.2.7.dist-info/METADATA,sha256=uHVe8upgxtCHgruhMvflhXpBfUpi5DD2eeDR4g9JPU8,35074
32
+ fusesell-1.2.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
33
+ fusesell-1.2.7.dist-info/entry_points.txt,sha256=Vqek7tbiX7iF4rQkCRBZvT5WrB0HUduqKTsI2ZjhsXo,53
34
+ fusesell-1.2.7.dist-info/top_level.txt,sha256=VP9y1K6DEq6gNq2UgLd7ChujxViF6OzeAVCK7IUBXPA,24
35
+ fusesell-1.2.7.dist-info/RECORD,,
@@ -32,6 +32,6 @@ __all__ = [
32
32
  "validate_config",
33
33
  ]
34
34
 
35
- __version__ = "1.2.6"
35
+ __version__ = "1.2.7"
36
36
  __author__ = "FuseSell Team"
37
37
  __description__ = "Local implementation of FuseSell AI sales automation pipeline"
@@ -377,15 +377,16 @@ class FuseSellPipeline:
377
377
  return {
378
378
  'org_id': self.config['org_id'],
379
379
  'org_name': self.config['org_name'],
380
- 'team_id': self.config.get('team_id'),
381
- 'team_name': self.config.get('team_name'),
382
- 'project_code': self.config.get('project_code'),
383
- 'staff_name': self.config.get('staff_name', 'Sales Team'),
384
- 'language': self.config.get('language', 'english'),
385
- # Data sources (matching executor schema)
386
- 'input_website': self.config.get('input_website', ''),
387
- 'input_description': self.config.get('input_description', ''),
388
- 'input_business_card': self.config.get('input_business_card', ''),
380
+ 'team_id': self.config.get('team_id'),
381
+ 'team_name': self.config.get('team_name'),
382
+ 'project_code': self.config.get('project_code'),
383
+ 'staff_name': self.config.get('staff_name', 'Sales Team'),
384
+ 'customer_name': self.config.get('customer_name', ''),
385
+ 'language': self.config.get('language', 'english'),
386
+ # Data sources (matching executor schema)
387
+ 'input_website': self.config.get('input_website', ''),
388
+ 'input_description': self.config.get('input_description', ''),
389
+ 'input_business_card': self.config.get('input_business_card', ''),
389
390
  'input_linkedin_url': self.config.get('input_linkedin_url', ''),
390
391
  'input_facebook_url': self.config.get('input_facebook_url', ''),
391
392
  'input_freetext': self.config.get('input_freetext', ''),
@@ -396,10 +397,11 @@ class FuseSellPipeline:
396
397
 
397
398
  # Action and continuation fields (for server executor compatibility)
398
399
  'action': self.config.get('action', 'draft_write'),
399
- 'selected_draft_id': self.config.get('selected_draft_id', ''),
400
- 'reason': self.config.get('reason', ''),
400
+ 'selected_draft_id': self.config.get('selected_draft_id', ''),
401
+ 'reason': self.config.get('reason', ''),
401
402
  'recipient_address': self.config.get('recipient_address', ''),
402
403
  'recipient_name': self.config.get('recipient_name', ''),
404
+ 'customer_email': self.config.get('customer_email', ''),
403
405
  'interaction_type': self.config.get('interaction_type', 'email'),
404
406
  'human_action_id': self.config.get('human_action_id', ''),
405
407
 
@@ -600,14 +602,16 @@ class FuseSellPipeline:
600
602
  if result.get('status') == 'success':
601
603
  data = result.get('data', {})
602
604
 
603
- if stage_name == 'data_preparation':
604
- customer_data = data
605
- elif stage_name == 'lead_scoring':
606
- lead_scores = data.get('scores', [])
607
- elif stage_name == 'initial_outreach':
608
- email_drafts.extend(data.get('drafts', []))
609
- elif stage_name == 'follow_up':
610
- email_drafts.extend(data.get('drafts', []))
605
+ if stage_name == 'data_preparation':
606
+ customer_data = data
607
+ elif stage_name == 'lead_scoring':
608
+ lead_scores = data.get('scores', [])
609
+ elif stage_name == 'initial_outreach':
610
+ drafts = data.get('drafts') or data.get('email_drafts') or []
611
+ email_drafts.extend(drafts)
612
+ elif stage_name == 'follow_up':
613
+ drafts = data.get('drafts') or data.get('email_drafts') or []
614
+ email_drafts.extend(drafts)
611
615
 
612
616
  # Generate performance analytics
613
617
  performance_analytics = self._generate_performance_analytics(duration)
@@ -115,10 +115,11 @@ class InitialOutreachStage(BaseStage):
115
115
  outreach_data = {
116
116
  'action': 'draft_write',
117
117
  'status': 'drafts_generated',
118
- 'email_drafts': saved_drafts,
119
- 'recommended_product': recommended_product,
120
- 'customer_summary': self._create_customer_summary(customer_data),
121
- 'total_drafts_generated': len(saved_drafts),
118
+ 'email_drafts': saved_drafts,
119
+ 'drafts': saved_drafts,
120
+ 'recommended_product': recommended_product,
121
+ 'customer_summary': self._create_customer_summary(customer_data),
122
+ 'total_drafts_generated': len(saved_drafts),
122
123
  'generation_timestamp': datetime.now().isoformat(),
123
124
  'customer_id': context.get('execution_id')
124
125
  }
@@ -327,8 +328,8 @@ class InitialOutreachStage(BaseStage):
327
328
  team_id = input_data.get('team_id')
328
329
  team_name = input_data.get('team_name')
329
330
  language = input_data.get('language')
330
- customer_name = input_data.get('customer_name')
331
- staff_name = input_data.get('staff_name')
331
+ customer_name = input_data.get('customer_name') or input_data.get('recipient_name')
332
+ staff_name = input_data.get('staff_name') or self.config.get('staff_name') or 'Sales Team'
332
333
  reminder_room = self.config.get('reminder_room_id') or input_data.get('reminder_room_id')
333
334
  draft_id = draft.get('draft_id') or 'unknown_draft'
334
335
 
@@ -355,6 +356,8 @@ class InitialOutreachStage(BaseStage):
355
356
  customextra['approach'] = draft.get('approach')
356
357
  if draft.get('mail_tone'):
357
358
  customextra['mail_tone'] = draft.get('mail_tone')
359
+ if recipient_address and 'customer_email' not in customextra:
360
+ customextra['customer_email'] = recipient_address
358
361
 
359
362
  return {
360
363
  'status': 'published',
@@ -368,6 +371,7 @@ class InitialOutreachStage(BaseStage):
368
371
  'team_name': team_name,
369
372
  'language': language,
370
373
  'customer_name': customer_name,
374
+ 'customer_email': recipient_address,
371
375
  'staff_name': staff_name,
372
376
  'customextra': customextra
373
377
  }
@@ -394,11 +398,18 @@ class InitialOutreachStage(BaseStage):
394
398
  return None
395
399
 
396
400
  contact_info = customer_data.get('primaryContact', {}) or {}
401
+ stage_results = context.get('stage_results', {}) or {}
402
+ data_acquisition = {}
403
+ if isinstance(stage_results, dict):
404
+ data_acquisition = stage_results.get('data_acquisition', {}).get('data', {}) or {}
397
405
 
398
406
  recipient_address = (
399
407
  input_data.get('recipient_address')
400
408
  or contact_info.get('email')
401
409
  or contact_info.get('emailAddress')
410
+ or data_acquisition.get('customer_email')
411
+ or data_acquisition.get('contact_email')
412
+ or input_data.get('customer_email')
402
413
  )
403
414
  if not recipient_address:
404
415
  self.logger.info("Skipping reminder scheduling: recipient email not available")
@@ -408,6 +419,8 @@ class InitialOutreachStage(BaseStage):
408
419
  input_data.get('recipient_name')
409
420
  or contact_info.get('name')
410
421
  or contact_info.get('fullName')
422
+ or data_acquisition.get('contact_name')
423
+ or data_acquisition.get('customer_name')
411
424
  or ''
412
425
  )
413
426
 
@@ -819,46 +832,80 @@ class InitialOutreachStage(BaseStage):
819
832
 
820
833
  def _build_prompt_replacements(self, customer_data: Dict[str, Any], recommended_product: Dict[str, Any], scoring_data: Dict[str, Any], context: Dict[str, Any]) -> Dict[str, str]:
821
834
  input_data = context.get('input_data', {})
822
- company_info = customer_data.get('companyInfo', {}) or {}
823
- contact_info = customer_data.get('primaryContact', {}) or {}
824
- language = input_data.get('language') or company_info.get('language') or 'English'
825
- contact_name = contact_info.get('name') or input_data.get('customer_name') or input_data.get('recipient_name') or 'there'
826
- company_name = company_info.get('name') or input_data.get('company_name') or 'the company'
827
- staff_name = input_data.get('staff_name') or input_data.get('sender_name') or 'Sales Team'
828
- org_name = input_data.get('org_name') or 'Our Company'
829
- selected_product_name = recommended_product.get('product_name') if recommended_product else None
830
-
831
- action = input_data.get('action', 'draft_write')
832
- action_labels = {
833
- 'draft_write': 'email drafts',
834
- 'draft_rewrite': 'email rewrites',
835
+ company_info = customer_data.get('companyInfo', {}) or {}
836
+ contact_info = dict(customer_data.get('primaryContact', {}) or {})
837
+ stage_results = context.get('stage_results', {}) or {}
838
+ data_acquisition = {}
839
+ if isinstance(stage_results, dict):
840
+ data_acquisition = stage_results.get('data_acquisition', {}).get('data', {}) or {}
841
+ if not contact_info.get('name'):
842
+ fallback_contact_name = (
843
+ data_acquisition.get('contact_name')
844
+ or data_acquisition.get('customer_contact')
845
+ or input_data.get('recipient_name')
846
+ or input_data.get('customer_name')
847
+ )
848
+ if fallback_contact_name:
849
+ contact_info['name'] = fallback_contact_name
850
+ if not contact_info.get('email'):
851
+ fallback_email = (
852
+ data_acquisition.get('customer_email')
853
+ or data_acquisition.get('contact_email')
854
+ or input_data.get('recipient_address')
855
+ or input_data.get('customer_email')
856
+ )
857
+ if fallback_email:
858
+ contact_info['email'] = fallback_email
859
+ customer_data = dict(customer_data)
860
+ customer_data['primaryContact'] = contact_info
861
+ language = input_data.get('language') or company_info.get('language') or 'English'
862
+ contact_name = contact_info.get('name') or input_data.get('customer_name') or input_data.get('recipient_name') or 'there'
863
+ company_name = company_info.get('name') or input_data.get('company_name') or 'the company'
864
+ staff_name = input_data.get('staff_name') or input_data.get('sender_name') or 'Sales Team'
865
+ org_name = input_data.get('org_name') or 'Our Company'
866
+ selected_product_name = recommended_product.get('product_name') if recommended_product else None
867
+ language_lower = language.lower() if isinstance(language, str) else ''
868
+ name_parts = contact_name.split() if isinstance(contact_name, str) else []
869
+ if name_parts:
870
+ if language_lower in ('vietnamese', 'vi'):
871
+ first_name = name_parts[-1]
872
+ else:
873
+ first_name = name_parts[0]
874
+ else:
875
+ first_name = contact_name or ''
876
+
877
+ action = input_data.get('action', 'draft_write')
878
+ action_labels = {
879
+ 'draft_write': 'email drafts',
880
+ 'draft_rewrite': 'email rewrites',
835
881
  'send': 'email sends',
836
882
  'close': 'email workflow'
837
883
  }
838
884
  action_type = action_labels.get(action, action.replace('_', ' '))
839
885
 
840
- company_summary = self._build_company_info_summary(
841
- company_info,
842
- contact_info,
843
- customer_data.get('painPoints', []),
844
- scoring_data
845
- )
846
- product_summary = self._build_product_info_summary(recommended_product)
847
- first_name_guide = self._build_first_name_guide(language, contact_name)
848
-
849
- replacements = {
850
- '##action_type##': action_type,
851
- '##language##': language.title() if isinstance(language, str) else 'English',
852
- '##customer_name##': contact_name,
886
+ company_summary = self._build_company_info_summary(
887
+ company_info,
888
+ contact_info,
889
+ customer_data.get('painPoints', []),
890
+ scoring_data
891
+ )
892
+ product_summary = self._build_product_info_summary(recommended_product)
893
+ first_name_guide = self._build_first_name_guide(language, contact_name)
894
+
895
+ replacements = {
896
+ '##action_type##': action_type,
897
+ '##language##': language.title() if isinstance(language, str) else 'English',
898
+ '##customer_name##': contact_name,
853
899
  '##company_name##': company_name,
854
- '##staff_name##': staff_name,
855
- '##org_name##': org_name,
856
- '##first_name_guide##': first_name_guide,
857
- '##selected_product##': selected_product_name or 'our solution',
858
- '##company_info##': company_summary,
859
- '##selected_product_info##': product_summary
860
- }
861
-
900
+ '##staff_name##': staff_name,
901
+ '##org_name##': org_name,
902
+ '##first_name_guide##': first_name_guide,
903
+ '##customer_first_name##': first_name or contact_name,
904
+ '##selected_product##': selected_product_name or 'our solution',
905
+ '##company_info##': company_summary,
906
+ '##selected_product_info##': product_summary
907
+ }
908
+
862
909
  return {key: (value if value is not None else '') for key, value in replacements.items()}
863
910
 
864
911
  def _build_company_info_summary(self, company_info: Dict[str, Any], contact_info: Dict[str, Any], pain_points: List[Dict[str, Any]], scoring_data: Dict[str, Any]) -> str:
@@ -932,20 +979,27 @@ class InitialOutreachStage(BaseStage):
932
979
  summary = "\n".join(lines).strip()
933
980
  return summary or 'Product details unavailable.'
934
981
 
935
- def _build_first_name_guide(self, language: str, contact_name: str) -> str:
936
- if not language:
937
- return ''
938
-
939
- language_lower = language.lower()
940
- if language_lower in ('vietnamese', 'vi'):
941
- if not contact_name or contact_name.lower() == 'a person':
942
- return "If the recipient's name is unknown, use `anh/chi` in the greeting."
943
- first_name = self._extract_first_name(contact_name)
944
- if first_name:
945
- return f"For Vietnamese recipients, use `anh/chi {first_name}` in the greeting to keep it respectful."
946
- return "For Vietnamese recipients, use `anh/chi` followed by the recipient's first name in the greeting."
947
-
948
- return ''
982
+ def _build_first_name_guide(self, language: str, contact_name: str) -> str:
983
+ if not language:
984
+ return ''
985
+
986
+ language_lower = language.lower()
987
+ name_parts = contact_name.split() if contact_name else []
988
+ if language_lower in ('vietnamese', 'vi'):
989
+ if not contact_name or contact_name.lower() == 'a person':
990
+ return "If the recipient's name is unknown, use `anh/chi` in the greeting."
991
+ vn_name = name_parts[-1] if name_parts else contact_name
992
+ if vn_name:
993
+ return f"For Vietnamese recipients, use `anh/chi {vn_name}` in the greeting to keep it respectful. Do not use placeholders or omit the honorific."
994
+ return "For Vietnamese recipients, use `anh/chi` followed by the recipient's first name in the greeting."
995
+
996
+ if name_parts:
997
+ en_name = name_parts[0]
998
+ return (
999
+ f'Use only the recipient\'s first name "{en_name}" in the greeting. '
1000
+ f'Start with "Hi {en_name}," or "Hello {en_name}," and do not use the surname or placeholders.'
1001
+ )
1002
+ return 'If the recipient name is unknown, use a neutral greeting like "Hi there," without placeholders.'
949
1003
 
950
1004
  def _extract_first_name(self, full_name: str) -> str:
951
1005
  if not full_name: