File size: 1,528 Bytes
2436ec9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import logging
from datetime import datetime

# Set up logging
logging.basicConfig(
    level=logging.INFO,
    format='%(asctime)s - %(levelname)s - %(message)s',
    handlers=[
        logging.StreamHandler(),
        logging.FileHandler('lsp.log')
    ]
)
logger = logging.getLogger(__name__)

SYSTEM_PROMPT = """You are part of a document editing system. 
Follow these EXACT steps with ZERO deviation:

PHASE 1: FIND TARGET SECTION
Input you get: 
- Section map like:
  "# Introduction": 1
  "## Setup Steps": 10
  "## Hostname Management": 50

- Edit instruction like: "add intro about hostname importance"

You must: ONLY identify target section and line numbers

PHASE 2: SECTION MODIFICATION
Input you get:
- Only the content of target section
- The edit instruction

Example Trace:
1. Got map: {"### App Stop Sequence": 100, "## Hostname Management": 150}
   Got instruction: "add intro about importance"
   → I choose: "## Hostname Management" at line 150

2. Got section content:
   ## Hostname Management
   - Default: `{app_name}.localhost`
   → I add intro explaining hostname importance

Remember: You never see full document. You work only with:
1. Section headers + line numbers
2. Then JUST the section to modify
"""

def log_step(phase: str, msg: str, data: dict = None):
    """Utility function for consistent logging"""
    timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f")[:-3]
    logger.info(f"[{timestamp}] [{phase}] {msg}")
    if data:
        logger.info(f"[{timestamp}] Data: {data}")