A code editing processing method and device, a storage medium and an electronic device

By using the matching and verification of the target line-level content hash tag and the real-time content hash value in the code editing request, the problem of location failure and code pollution under multiple rounds of concurrent modification by the AI ​​code agent is solved, and high-precision and safe code editing is achieved.

CN122633237APending Publication Date: 2026-08-25CHONGQING ANT CONSUMER FINANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611009345.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-08
Publication Date
2026-08-25

AI Technical Summary

Technical Problem

In existing technologies, when AI code agents rely on static line numbers for code editing in multi-round interaction or concurrent modification scenarios, it is easy to cause location failure and code pollution, making it difficult to meet the requirements of industrial-grade core code libraries for editing security and accuracy.

Method used

By monitoring the target line-level content hash tag carried in code editing requests, including the target line number and the target content hash value, the target line code is located and the real-time content hash value is calculated for matching and verification. The editing operation is only performed when a match is found, and fault-tolerant addressing and positioning processing is combined to ensure editing accuracy.

Benefits of technology

It improves the accuracy of AI-assisted programming modifications and concurrency safety boundaries, ensuring that each editing command is accurately implemented in the original semantic context, reducing the risk of code pollution and increasing the success rate of editing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122633237A_ABST
    Figure CN122633237A_ABST
Patent Text Reader

Abstract

The embodiment of the specification discloses a code editing processing method and device, a storage medium and an electronic equipment, wherein the method comprises the following steps: monitoring a code editing request initiated by a code intelligent agent based on a code processing large model for a target source code file; determining a target line-level content hash tag for target line code carried by the code editing request; positioning the corresponding target line code in the target source code file based on the target line number therein and calculating a corresponding real-time content hash value; matching and verifying the real-time content hash value with the target content hash value therein; and if the matching is correct, performing a code editing operation on the target code line in the target source code file based on the code editing request. By adopting the embodiment of the specification, accurate positioning of artificial intelligence code editing can be realized, and the accuracy and success rate of code editing are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This specification relates to the field of computer technology, and in particular to a code editing and processing method, apparatus, storage medium, and electronic device. Background Technology

[0002] With the rapid development of artificial intelligence technology, AI agents driven by large language models (LLM) have been widely used in software engineering, especially in assisted programming scenarios such as automated code generation, code refactoring, and code repair, thereby improving R&D efficiency. In these scenarios, the AI ​​agent needs to frequently read, understand, and edit local lines of code from existing source code files.

[0003] However, the target code faces a severe accuracy bottleneck when performing automated code editing tasks. Conventional editing schemes typically rely on absolute line numbers as unique identifiers to locate the target line of code. But in real-world engineering scenarios involving multiple rounds of interaction or concurrent modifications, preceding insertion or deletion operations can cause global offsets in subsequent line numbers. In such cases, if the system still relies on static line numbers cached by the agent to perform modifications, it is highly susceptible to location failures or erroneous overwriting. This low-precision location method not only easily leads to formatting errors but also poses a high risk of code pollution, resulting in a low success rate for automated modifications and failing to meet the stringent requirements of industrial-grade core codebases for editing security and accuracy. Summary of the Invention

[0004] This specification provides a code editing processing method, apparatus, storage medium, and electronic device, the technical solutions of which are as follows: Firstly, embodiments of this specification provide a code editing processing method, the method comprising: Monitor code editing requests initiated by code agents driven by a large code processing model for a target source code file; Determine the target line-level content hash tag for the target line of code carried in the code editing request, wherein the target line-level content hash tag includes the target line number and the target content hash value for the target line of code; Based on the target line number, locate the corresponding target line code in the target source code file and calculate the real-time content hash value corresponding to the target line code. Then, match and verify the real-time content hash value with the target content hash value. If the real-time content hash value matches the target content hash value, then code editing operations are performed on the target code line in the target source code file based on the code editing request.

[0005] Secondly, embodiments of this specification provide a code editing processing apparatus, the apparatus comprising: The monitoring module is used to monitor code editing requests initiated by code intelligence agents driven by a large code processing model for the target source code file. The monitoring module is used to determine the target line-level content hash tag for the target line of code carried in the code editing request. The target line-level content hash tag includes the target line number and the target content hash value for the target line of code. The verification module is used to locate the target line code in the target source code file based on the target line number and calculate the real-time content hash value corresponding to the target line code, and match and verify the real-time content hash value with the target content hash value; The operation module is used to perform code editing operations on the target code line in the target source code file based on the code editing request if the real-time content hash value matches the target content hash value.

[0006] Thirdly, embodiments of this specification provide a computer storage medium storing a plurality of instructions adapted for loading by a processor and executing the above-described method steps.

[0007] Fourthly, this specification provides a computer program product storing at least one instruction adapted to be loaded by a processor and to execute the method steps of one or more embodiments of this specification.

[0008] Fifthly, this specification provides a computer program product storing at least one instruction adapted to be loaded by a processor and to execute the method steps of one or more embodiments of this specification.

[0009] Sixthly, embodiments of this specification provide an electronic device that may include: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to execute the above-described method steps.

[0010] The beneficial effects of the technical solutions provided in some embodiments of this specification include at least the following: In one or more embodiments of this specification, a technical means is employed to monitor code editing requests carrying target line-level content hash tags, including target line numbers and target content hash values. After initially locating the target code line based on the target line number, the real-time content hash value of the code line is pre-calculated and verified to ensure it matches the target content hash value. The code editing operation is only performed when the verification is successful. This effectively solves the technical problems in the prior art where AI code agents rely solely on static line numbers for code editing, such as location failure, misaligned overwriting, and large-scale code pollution caused by line number offsets due to multiple rounds of concurrent modifications or collaborative tasks. The traditional pure location-dependent addressing method is upgraded to a dual strong binding verification of spatial location and content fingerprint, enabling the system to perceive and intercept dirty data and expired contexts. This eliminates the static dependence of the automated editing process on the absolute stability of line numbers. Even in complex, high-frequency multi-person collaborative development environments, it ensures that every editing instruction of the code agent is accurately implemented in the expected original semantic context, thereby improving the modification accuracy, concurrency safety boundary, and editing success rate of AI-assisted programming. Attached Figure Description

[0011] To more clearly illustrate the technical solutions in the embodiments or prior art of this specification, the drawings used in the description of the embodiments or prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0012] Figure 1 This is a flowchart illustrating a code editing method provided in an embodiment of this specification; Figure 2 This is a schematic diagram of a process for generating row-level content hash tags provided in the embodiments of this specification; Figure 3 This is a schematic diagram of a fault-tolerant addressing and positioning process provided in the embodiments of this specification; Figure 4 This is a schematic diagram of the structure of a code editing and processing device provided in the embodiments of this specification; Figure 5 This is a schematic diagram of the structure of an electronic device provided in the embodiments of this specification. Detailed Implementation

[0013] The technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this specification, and not all embodiments. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this specification.

[0014] In the description of this specification, it should be understood that the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. In the description of this specification, it should be noted that, unless otherwise expressly specified and limited, "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or devices. Those skilled in the art can understand the specific meaning of the above terms in this specification based on the specific circumstances. Furthermore, in the description of this specification, unless otherwise stated, "multiple" means two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship.

[0015] The present specification will now be described in detail with reference to specific embodiments.

[0016] In one embodiment, such as Figure 1 As shown, a code editing and processing method is proposed. This method can be implemented using a computer program and can run on a code editing and processing device based on the von Neumann architecture. This computer program can be integrated into an application or run as a standalone utility application. The code editing and processing device can be a terminal device, including but not limited to: personal computers, tablets, handheld devices, vehicle-mounted devices, server devices, computing devices, or other processing devices connected to a wireless modem. In different networks, the terminal device can be called by different names, such as: user equipment, access terminal, user unit, user station, mobile station, mobile station, remote station, remote terminal, mobile device, user terminal, terminal, wireless communication device, user agent or user equipment, cellular phone, cordless phone, terminal device in 5G networks or future evolved networks, etc.

[0017] Specifically, the code editing process includes: S102: Monitor code editing requests initiated by code agents driven by a large code processing model for target source code files; Large-scale code processing models refer to large language models (LLMs) that have been pre-trained on massive computer program corpora and possess deep semantic understanding, code logic reasoning, and program paragraph generation capabilities. It should be noted that large-scale code processing models can adopt large language models (LLMs) with auxiliary programming capabilities such as automated code generation, code refactoring, and code repair. Large language models (LLMs) include, but are not limited to, DeepSeek large models, GPT series large models, Qianwen series large models, Gemini series large models, etc.

[0018] Code-based intelligent agents refer to AI agents that use a large code processing model as their decision-making center. They are endowed with contextual memory, task decomposition and planning capabilities, and can interact with the external code host environment by outputting structured instructions.

[0019] The target source code file refers to the specific text file that the code intelligence agent needs to read and modify when performing auxiliary code programming tasks such as requirements development, code review, or defect repair.

[0020] A code editing request refers to a message sent by a code agent to a background execution system. This message carries at least control parameters and data payloads that indicate specific modification operations (such as overwriting, inserting, or removing) to the target source code file.

[0021] As an illustration, the terminal device pre-exposes a dedicated editing and execution application programming interface (API) or registers an event callback service for the code agent through the server. When the code agent detects that it has completed a code inference task and determines that a certain section of logic in the target source code file needs to be changed, it serializes the generated modification instructions into a standard format (such as a Hypertext Transfer Protocol request or a Remote Procedure Call message) and actively calls the aforementioned API to push the request to the terminal device's system. The terminal device's system continuously monitors the status of relevant ports or service buffers through an underlying event-driven model. Once it detects a new request access event triggered on the corresponding port, the server process is awakened and reads the data packet in the buffer, thereby completing the monitoring and reception of the initiated code editing request. This mechanism ensures the data integrity of the request packet and effectively reduces the system's polling resource consumption.

[0022] S104: Determine the target line-level content hash tag for the target line code carried in the code editing request, wherein the target line-level content hash tag includes the target line number and the target content hash value for the target line code; The target line-level content hash label refers to a composite data structure included in the code edit request payload, used to declare the specific line of code that the code agent expects to modify and its corresponding content state.

[0023] The target line number refers to the relative or absolute spatial index of the line of code to be modified in the source file, as recorded in the context memory or current view of the code agent when constructing the code editing request.

[0024] The target content hash value refers to the content digest signature of the target line of code before this modification. This signature is the benchmark for subsequent consistency matching verification by the system.

[0025] As an illustration, after monitoring and intercepting a code editing request, the payload message of the request is first read. In this specification, since the code agent typically assembles the request according to a preset communication protocol, it can call the underlying string parsing engine to fully search the payload message for feature strings conforming to the standard tag format using pre-configured regular expressions or specific key-value matching rules, thereby extracting the target line-level content hash tag. The tag string is then segmented according to a predefined delimiter. After segmentation, the numeric character field of the delimiter is converted into integer data to determine the target line number for the target line of code; simultaneously, the character data of the delimiter is determined as the target content hash value. The separated target line number and target content hash value are stored separately in independent memory addresses within the verification task context for subsequent calls by S106.

[0026] S106: Locate the target line code in the target source code file based on the target line number and calculate the real-time content hash value corresponding to the target line code; then match and verify the real-time content hash value with the target content hash value. The target line code refers to the line of original text data that is directly located and extracted in the source code file based on the line number index parsed from the code editing request and the target line number as the spatial addressing basis.

[0027] Real-time content hash value refers to the dynamic digest fingerprint generated at the current execution moment when an editing request is received, by recalculating the content of the located target line code using the same hash algorithm (such as hash hash algorithm) as the source (i.e., the same hash algorithm used to generate the target content hash value).

[0028] The matching and verification process is a logical judgment process that compares the dynamic digest fingerprint obtained by the system in real time with the static baseline fingerprint carried in the request according to consistency rules. It is used to intercept code errors caused by code version conflicts at the source.

[0029] In a schematic manner, after obtaining the target line number, the target source code file is opened and a file data stream is established in read-only mode. The file pointer reads the text data line by line, while an internal line number counter is synchronously incremented. Reading is paused when the counter value is exactly equal to the target line number, and the complete text data of the line currently pointed to by the file pointer is extracted into memory as the target line code. The extracted target line code is then fed into a hashing unit, which calls a preset hash encryption function to generate a real-time content hash value for that line code. A strict string equality comparison is performed between the generated real-time content hash value and the target content hash value determined in the previous step. If the comparison result shows that the character sequences of the two are completely identical, a signal indicating successful matching is output; if any difference exists, it indicates that the line code was modified by other terminals before the large model-driven agent initiated the request (in code development projects, this usually involves collaborative programming across multiple terminal devices), or that the line number shift was caused by previous additions or deletions, and a signal indicating failed matching is output.

[0030] In one feasible implementation, if the real-time content hash value is inconsistent with the target content hash value, the code editing request is rejected and an exception message is generated for the target line of code. Among them, the exception message refers to the structured feedback message actively constructed after the matching verification fails. This message usually encapsulates the reason for the verification failure, the expected status parameters, and the current actual status parameters of the system, which is used to guide the caller (such as the code agent) to perform error addressing and troubleshooting or status reset.

[0031] For illustration, if the real-time content hash value is inconsistent with the target content hash value, a snapshot of the verification conflict is asynchronously collected in the background, including the absolute path of the source file where the conflict occurred, the timestamp of the conflict, and the specific code snippet differences that caused the conflict. Based on the snapshot data, an exception message is generated and pushed as an alarm event via a message queue, such as to the user or the server.

[0032] S108: If the real-time content hash value matches the target content hash value, then perform a code editing operation on the target code line in the target source code file based on the code editing request.

[0033] Code editing operations refer to a set of actions that substantially change a specific block of text in a computer's file system or memory buffer according to instructions from the upper-level application. These operations include atomic operations such as overwriting or replacing line content, inserting entire lines before or after the target line, and physically removing the target line itself.

[0034] This process illustratively analyzes the specific instruction type and target text content of the payload in the code editing request. It obtains the file handle of the target source code file in read-write mode and precisely positions the file operation pointer to the offset address of the target code line. If the instruction is a replacement operation, string slicing and concatenation techniques are used to completely overwrite the memory space of the original target code line with the new code text in the request. If the instruction is a deletion operation, the cursor of the file stream is adjusted to completely erase the line of data and merge adjacent newline characters. After the operation is complete, the underlying operating system's cache refresh interface is forcibly invoked to synchronize the physical modifications to the storage medium. Thus, while ensuring absolute context safety, physical-level code editing driven by the code agent is completed.

[0035] In the embodiments of this specification, a technical means is used to monitor code editing requests carrying target line-level content hash tags including target line number and target content hash value. After initially locating the target code line based on the target line number, the real-time content hash value of the code line is pre-calculated and verified to see if it matches the target content hash value. The code editing operation is only performed when the verification is successful. This effectively solves the technical problems in the prior art where artificial intelligence code agents rely solely on static line numbers for code editing, such as positioning failure, misaligned overwriting, and large-scale code pollution caused by line number offset due to multiple rounds of concurrent modifications or collaborative tasks. The traditional pure location-dependent addressing method is upgraded to a dual strong binding verification of spatial location and content fingerprint. This enables the system to perceive and intercept dirty data and expired context, freeing it from the static dependence of the automated editing process on the stability of absolute line numbers. Even in complex, high-frequency multi-human collaborative development environments, it can ensure that every editing instruction of the code agent is accurately implemented in the expected original semantic context, thereby improving the modification accuracy, concurrency safety boundary, and editing success rate of artificial intelligence-assisted programming.

[0036] Optional, please see Figure 2 , Figure 2 This is a schematic diagram of a line-level content hash tag generation process proposed in this specification. Specifically, before the code intelligence agent, driven by a large code processing model, initiates a code editing request for the target source code file, the process also includes: S202: Parse the line code of the target source code file to obtain the line code content hash value, and generate a line-level content hash tag bound to each line code based on the line code content hash value and the original code line number; The line code content hash value refers to a fixed-length value that uniquely represents the semantic features of a single line of text content in the source code, after being processed by a preset format standardization process and calculated by a hash algorithm.

[0037] The original code line number refers to the initial physical line position index of each line of code in the source code file during the initialization marking phase.

[0038] A row-level content hash tag is a composite identifier that logically couples spatial location features (row number) with content fingerprint features (hash value), and is used to provide artificial intelligence with a location handle with self-verification capabilities.

[0039] As an illustration, the parsing engine is invoked to scan the target source code file line by line, extracting the raw text string of each line of code. For each extracted line of code, content parsing is performed, filtering out redundant whitespace characters and comments, and calculating the line code content hash value using a preset hash algorithm. This line code content hash value is then encapsulated with the corresponding original line number according to a preset topology, generating a line-level content hash tag strongly bound to each line of code.

[0040] In one feasible implementation, S202 can be performed in the following manner: Step A2: Perform a format removal operation on the parsed line code to obtain the core semantic text after removing code format noise; Formatting removal refers to the process of removing redundant characters (such as indentation, consecutive spaces, tabs, and newlines) from the original code lines using text cleaning rules or algorithms that do not affect the underlying execution logic of the program.

[0041] Core semantic text refers to the pure code character sequence that remains after the original code text has been filtered for formatting noise, consisting of valid instructions, variable names, operators, etc.

[0042] Step A4: Invoke the preset hash algorithm to extract the digital fingerprint of the core semantic text and generate the line code content hash value; Step A6: Concatenate the hash value of the line code content with the corresponding original line number using a preset separator to generate a line-level content hash tag.

[0043] Predefined delimiters refer to specific characters or symbols (such as #, |, or specific escape characters) that are predefined to clearly define the boundaries of data fields when combining different types of data dimensions.

[0044] Indicatively, steps A2-A6 are executed to read the original line code. The built-in regular expression engine or string replacement function is invoked to perform a global scan of the text, precisely removing indentation spaces, tabs, and invisible line break control characters. This transforms the source code, which contains developer-specific coding styles, into highly standardized core semantic text. This core semantic text is then input into a pre-defined hash encryption module, where a one-way feature digest operation is performed using algorithms such as Secure Hash Algorithms (SHA series). This digest serves as the unique digital fingerprint and hash value for each line of code. The obtained original line number, system-predefined separator, and line code hash value are sequentially written into a buffer. Through continuous string concatenation operations, the composite data is assembled, generating a line-level content hash label.

[0045] S204: Send the target source code file carrying the line-level content hash tag to the code agent driven by the code processing big model, so as to instruct the code agent to generate a code editing request based on the line-level content hash tag when there is a code editing task.

[0046] Schematic, the generated line-level content hash tags are embedded into the target source code file via metadata injection or inline comments, forming a target source code file carrying the line-level content hash tags. This tagged target source code file is then sent to a code agent driven by a large code processing model. This process aims to provide the code agent with an operational map with deterministic references, instructing it to construct its code editing requests based on the line-level content hash tags when subsequent code editing needs arise, thereby ensuring the accuracy of subsequent editing instructions.

[0047] In the embodiments of this specification, before monitoring code editing requests, the target source code is parsed line by line to generate line-level content hash tags that bind the original line number and the hash value of the code content. The code file carrying the tag is then sent to the code agent as the operation benchmark. This pre-builds a set of deterministic and self-verifying digital references for the code agent, forcing the large model to strictly follow the constraints when planning and generating code editing tasks. This blocks the possibility of fuzzy references and blind modifications from the source of the interaction link, reduces the computational overhead of subsequent server-side fault-tolerant addressing and consistency verification, and lays a high-precision and highly reliable underlying data interaction foundation for the entire AI-assisted programming system.

[0048] Optionally, after performing the matching and verification between the real-time content hash value and the target content hash value, the following methods can also be referenced: If the real-time content hash value is inconsistent with the target content hash value, then based on the target content hash value in the target line-level content hash tag, fault-tolerant addressing and positioning processing is performed within the preset line number offset range of the target source code file.

[0049] The preset line number offset range refers to the pre-configured effective search interval that radiates upwards and downwards from the target line number (e.g., extending fifty lines before and after the target line number). It is used to define the maximum boundary that the system is allowed to perform blind search when code misalignment occurs, in order to balance the addressing success rate and system performance overhead.

[0050] Fault-tolerant addressing and location processing refers to a backup compensation addressing algorithm triggered when direct addressing based on absolute spatial location (i.e., a single target line number) fails. This fault-tolerant addressing and location processing abandons the absolute dependence on static line numbers and instead uses the content digital fingerprint as the core anchor point to rescan and lock the target code line that has experienced physical location drift within a certain area.

[0051] In one feasible implementation, when a discrepancy is detected between the real-time content hash value and the target content hash value, a dedicated analysis buffer is allocated in memory. Using underlying memory-mapped file technology, the entire contiguous data block falling within the preset line number offset range of the target source code file is loaded into this analysis buffer at once. A multi-threaded concurrent computation engine is scheduled to divide this data block into lines and allocate it to different worker threads. Each thread concurrently performs format elimination and hash calculation on its assigned candidate lines of code, generating a local hash mapping table for the current data block. Subsequently, the main thread utilizes the efficient addressing characteristics of hash tables, using the target content hash value as the retrieval key, to directly perform a constant-time reverse key-value lookup in this local hash mapping table. If the lookup matches, the actual offset line number of the current target code line in the physical file is deduced through the mapping relationship, thus achieving fault-tolerant relocation. This process upgrades the traditional line-by-line reading-computation-comparison serial blocking process to memory-based concurrent block processing, ensuring extremely high fault-tolerant relocation accuracy while minimizing computation time, ensuring a lightning-fast response experience for the code agent in complex collaborative networks.

[0052] In one feasible implementation, such as Figure 3 As shown, Figure 3 This is a schematic diagram of a fault-tolerant addressing and positioning process. Specifically, based on the target content hash value in the target line-level content hash tag, fault-tolerant addressing and positioning processing is performed within a preset line number offset range of the target source code file. The following method can be used as a reference: S302: Construct a sliding search window that extends upwards and / or downwards, using the target row number as the central reference point; The central reference point refers to the initial coordinate anchor position where the fault-tolerant addressing mechanism expands its search in the code space. It is usually the original target line number indicated in the code edit request message that has not yet experienced verification drift.

[0053] A sliding search window refers to a logical viewing area containing multiple consecutive lines of code that is dynamically divided in memory or a file stream. This area has pre-configured upper and lower bounds to limit the safety and performance thresholds for the system to perform blind searches when the line number of the code drifts.

[0054] S304: Calculate the candidate real-time hash value of the candidate line code in the sliding search window line by line, and match and verify the candidate real-time hash value with the target content hash value; The alternative real-time hash value refers to the dynamic digital fingerprint generated by performing real-time hashing on the current text content of each non-target line (i.e., alternative line) extracted within the sliding search window during the fault-tolerant scanning phase.

[0055] S306: If a matching candidate real-time hash value is found in the sliding search window, the real-time candidate line corresponding to the matching candidate real-time hash value is redefined as the target code line, and the step of performing code editing operation on the target code line in the target source code file based on the code editing request is triggered. S308: If no matching alternative real-time hash value is found in the sliding search window, the code editing request is rejected and an exception message is generated for the target line of code.

[0056] Indicatively, in step S302, using the target line number carried in the code editing request as the central reference point, the system reads the offset radius parameter set in the global configuration file and constructs a sliding search window that expands symmetrically upwards and / or downwards in memory. In step S304, the reading pointer is driven within the sliding search window to extract the core semantic text of each candidate line of code line by line, according to the order of distance from the central reference point (e.g., sequentially reading candidate lines of code moved up and down one line at a time), and performs hash operations to obtain the corresponding candidate real-time hash value. This hash value is then sent to a logic comparator for matching and verification with the target content hash value. In step S306, if the comparator outputs a perfectly matching level signal at a certain step of the scan cycle, the current search loop is immediately suspended. The physical line number corresponding to the matching candidate real-time hash value is redefined as the latest target code line position in the internal address routing table, triggering subsequent code editing operation logic to ensure that the code agent's modification instructions accurately fall on the actual code after the offset. Conversely, in S308, if the system file pointer traverses all candidate rows in the sliding search window and the comparator does not return a matching signal, it is determined that the target code has been destructively overwritten or physically deleted. At this time, the master transaction will be forcibly blocked, the code editing request will be refused, and an exception message containing out-of-bounds status and hash missing reason will be thrown downstream through the communication interface.

[0057] In this specification, S302-S308 are implemented to improve the success rate and robustness of code intelligence in complex environments. At the same time, the circuit breaker threshold for fault-tolerant search is clearly defined through preset window boundaries, achieving a balance between maximizing the completion rate of automated editing and preventing destructive code tampering.

[0058] In one feasible implementation, after specifically executing the code editing operation on the target code line in the target source code file based on the code editing request, the following approach can also be referenced: Step B2: If the code editing operation is an insertion and / or replacement operation, then determine the content hash value of the target line code after editing and update the line-level content hash label of the target line code based on the content hash value, and perform incremental updates of the label line number parameter for the subsequent line code located after the target line code that is affected by the line number offset; The insertion operation refers to adding a new line of code at the target location in the source code file. This action causes the physical line number of the original location and all subsequent lines of code to be shifted down. The replacement operation refers to replacing the original code text at the target location with new code content. Usually, only the content of that line is changed without affecting the total number of lines in the file. Subsequent lines of code refer to the set of all original lines of code that follow the currently manipulated target line of code in the physical sequence of the source code file; In a demonstrative manner, the system performs real-time parsing on the target line of code after editing. It recalculates the hash value of the new content in that line using a pre-defined hash algorithm and writes it as the latest content fingerprint into the corresponding line-level content hash tag, thus overwriting the target line identifier's attributes. If the current editing action is identified as an insertion operation, the addition of the new line causes an offset in the physical line numbers of all subsequent original code lines. A cascading traversal engine is then activated to sequentially retrieve the tag data of all subsequent lines of code following the target line. For each subsequent line of code, the original line number parameter is extracted from its tag, and an offset increment corresponding to the number of inserted lines is added to it, thus completing the incremental update of the tag line number parameter. This ensures that even after structural changes to the file content, all existing positioning tags remain aligned with the current physical view in real time.

[0059] Step B4: If the code editing operation is a deletion operation, remove the line-level content hash tag corresponding to the target code line, and correct the tag line number parameter for the subsequent lines of code affected by the line number offset after the target code line.

[0060] The deletion operation refers to the action of completely erasing the text content and newline characters of a specific target line of code from the physical storage or memory view of the target source code file according to the instructions of the code agent. This action may cause all existing lines of code after that position to be physically moved forward.

[0061] Correction can refer to the data maintenance process of using arithmetic decrement operations to correct the line number index value of the line-level content hash tag that has a physical location offset due to the deletion of the preceding code line, in order to eliminate the error between the historical line number and the current real line number.

[0062] Line number offset refers to the spatial misalignment of subsequent lines in the file stream due to the physical absence of the target line of code, resulting in a smaller absolute sequence number.

[0063] In a schematic representation, the target code line is precisely located in the target source code file. The file read / write interface is invoked to physically erase the business logic characters, various formatting characters, and line-level content hash tags attached to the beginning and end of the file stream, thus destroying the tags. With the removal of this line, all the original code lines below it experience an upward shift in line number in physical space. To correct this shift, the terminal device's system suspends a background tag synchronization thread. This thread scans the target source code file line by line in linear order, starting from the line following the deleted position, until the end of the file. During the scan, the line-level content hash tags of each subsequent line of code are extracted. The tag line number parameter is parsed using a preset delimiter, and an arithmetic subtraction operation equivalent to the number of deleted lines (usually minus one) is performed on this value in the memory register. The line number value corrected by arithmetic subtraction is then reconstructed with the original content hash value and written back to the tag storage area of ​​that line. Through this linear line-by-line read and rewrite mechanism, it is ensured that the spatial parameters of all remaining tags in the file are self-consistent and aligned after each deletion operation.

[0064] In one feasible implementation, the code editing request is a batch editing request comprising multiple sequentially arranged code editing operations. Before specifically executing the step of locating the corresponding target line code in the target source code file based on the target line number and calculating the real-time content hash value corresponding to the target line code, the following method may also be referenced: Step C2: Construct a virtual execution state tree for the target source code file, and simulate the execution of the code editing operations in sequence according to the order of the code editing operations; A batch editing request refers to a data set containing multiple code editing operation instructions with a strict execution order, issued by a code agent in a single network interaction.

[0065] A virtual execution state tree is a tree-like or chain-like data structure built in memory that maps to the current physical state of the target source code file. It is used for sandbox simulation and verification of batch modification instructions without touching the underlying physical file.

[0066] Step C4: Monitor the line number change parameters caused by the preceding code editing operation in the virtual execution state tree, and deduce the theoretical line number offset caused by it to subsequent code editing operations; The theoretical line number offset refers to the expected displacement value (such as positive increment or negative decrement) of the code line located at the subsequent position on the spatial index caused by the insertion or deletion action located at the preceding position of the execution sequence during virtual simulation.

[0067] Step C6: Based on the theoretical line number offset, repair the line number parameter of the target line-level content hash tag carried by subsequent code editing operations in the batch editing request. Based on the repaired line number parameter, perform the step of locating the corresponding target line code in the target source code file based on the target line number and calculating the real-time content corresponding to the target line code. Repair refers to using the derived offset to actively rewrite the tag parameters carried by subsequent code editing operation instructions that have not yet been executed in memory, so that they can dynamically adapt to the code structure deformation caused by the preceding operation, thereby realizing the recovery of batch instructions.

[0068] Indicatively, step C2 instantiates a lightweight virtual execution state tree in memory, corresponding one-to-one with the line structure of the target source code file. The received batch edit request payload is unpacked, and a sorted queue of operation instructions is extracted. These instructions are then simulated and applied one by one on the virtual execution state tree. In step C4, the terminal device uses a state listener to capture real-time structural changes in the virtual execution state tree after each simulated operation. For example, if the preceding operation inserts three new nodes after a certain node, the listener immediately records the baseline point at that position and the line number change parameter "+3", and uses an accumulator to deduce the theoretical line number offset of this action to all nodes below it. In step C6, all subsequent code editing operations following the above operation in the batch edit request are traversed. The target line-level content hash tags carried by these subsequent operations are extracted, and the original target line numbers encapsulated within them are extracted. Arithmetic addition and subtraction operations are performed with the deduced theoretical line number offsets to complete the memory-level static repair of the line number parameters. After all the tag parameters in the entire batch processing queue have been self-repaired, the terminal device's system can then truly use these repaired line number parameters, which are completely consistent with the current dynamic context, to perform the matching and verification logic of the target line location and the real-time content hash value in the physical file.

[0069] This specification provides code editing processing with memory-level predictive and parameter self-healing capabilities for high-concurrency batch editing tasks. It cleverly transforms the inevitable physical position drift during multi-step cascading modifications into the early resolution of logical states, breaking the dependence of subsequent operation instructions on the original static code snapshot, reducing the system's input / output read / write trial and error overhead on real physical files, and further improving the batch success rate of the code agent when performing high-order complex engineering tasks such as large-scale refactoring and collaborative modification of multiple logical blocks.

[0070] The following will combine Figure 4 This specification provides a detailed description of the code editing processing apparatus provided in the embodiments. It should be noted that... Figure 4 The code editing and processing device shown is used to execute this specification. Figures 1-3The methods shown in the embodiments are illustrated for ease of explanation, showing only the parts related to the embodiments of this specification. For specific technical details not disclosed, please refer to this specification. Figures 1-3 The example shown.

[0071] Please see Figure 4 This diagram illustrates the structure of a code editing processing apparatus according to an embodiment of this specification. The code editing processing apparatus 1 can be implemented as all or part of a user terminal through software, hardware, or a combination of both. According to some embodiments, the code editing processing apparatus 1 includes a monitoring module 11, a verification module 12, and an operation module 13, specifically used for: Monitoring module 11 is used to monitor code editing requests initiated by a code intelligence agent driven by a large code processing model for a target source code file; The monitoring module 11 is used to determine the target line-level content hash tag for the target line code carried in the code editing request. The target line-level content hash tag includes the target line number and the target content hash value for the target line code. The verification module 12 is used to locate the target line code in the target source code file based on the target line number and calculate the real-time content hash value corresponding to the target line code, and to match and verify the real-time content hash value with the target content hash value. The operation module 13 is used to perform code editing operations on the target code line in the target source code file based on the code editing request if the real-time content hash value matches the target content hash value.

[0072] Optionally, before monitoring the code editing request initiated by the code intelligence agent driven by the large code processing model against the target source code file, the method further includes: Line code content hash value is obtained by parsing the line code of the target source code file, and line-level content hash tags are generated based on the line code content hash value and the original code line number to bind each line code; The target source code file carrying the line-level content hash tag is sent to a code agent driven by a large code processing model, instructing the code agent to generate a code editing request based on the line-level content hash tag when a code editing task exists.

[0073] Optionally, the step of parsing the line code of the target source code file to obtain line code content hash values, and generating line-level content hash tags bound to each line code based on the line code content hash values ​​and the original code line numbers, includes: Perform a format removal operation on the parsed lines of code to obtain the core semantic text after removing code format noise; A preset hash algorithm is invoked to extract the digital fingerprint of the core semantic text and generate a hash value for the line code content; The hash value of the line code content is concatenated with the corresponding original line number using a preset separator to generate a line-level content hash tag.

[0074] Optionally, after matching and verifying the real-time content hash value with the target content hash value, the method further includes: If the real-time content hash value does not match the target content hash value, the code editing request is rejected and an exception message is generated for the target line of code; or, If the real-time content hash value is inconsistent with the target content hash value, then based on the target content hash value in the target line-level content hash tag, fault-tolerant addressing and positioning processing is performed within the preset line number offset range of the target source code file.

[0075] Optionally, the step of performing fault-tolerant addressing and positioning processing within a preset line number offset range of the target source code file based on the target content hash value in the target line-level content hash tag includes: Using the target row number as the central reference point, construct a sliding search window that extends upwards and / or downwards; Calculate the candidate real-time hash value of the candidate line code in the sliding search window line by line, and match and verify the candidate real-time hash value with the target content hash value; If a matching candidate real-time hash value is found in the sliding search window, the real-time candidate line corresponding to the matching candidate real-time hash value is redefined as the target code line, and the step of performing code editing operation on the target code line in the target source code file based on the code editing request is triggered. If no matching alternative real-time hash value is found within the sliding search window, the code editing request is rejected and an exception message is generated for the target line of code.

[0076] Optionally, after performing code editing operations on the target code lines in the target source code file based on the code editing request, the method further includes: If the code editing operation is an insertion and / or replacement operation, then the content hash value of the target line code after editing is determined and the line-level content hash label of the target line code is updated based on the content hash value, and the label line number parameter is incrementally updated for the subsequent line code located after the target line code that is affected by the line number offset. If the code editing operation is a deletion operation, then the line-level content hash tag corresponding to the target code line is removed, and the tag line number parameter is corrected for the subsequent lines of code affected by the line number offset after the target code line.

[0077] Optionally, the code editing request may be a batch editing request comprising multiple sequentially arranged code editing operations. Before locating the corresponding target line code in the target source code file based on the target line number and calculating the real-time content hash value corresponding to the target line code, the method further includes: Construct a virtual execution state tree for the target source code file, and simulate the execution of the code editing operations in sequence according to the order of the code editing operations; Monitor the line number change parameters caused by the preceding code editing operation in the virtual execution state tree, and deduce the theoretical line number offset caused by it to subsequent code editing operations; Based on the theoretical line number offset, the line number parameter of the target line-level content hash tag carried by subsequent code editing operations in the batch editing request is repaired. Based on the repaired line number parameter, the corresponding target line code in the target source code file is located based on the target line number, and the real-time content hash value corresponding to the target line code is calculated. The real-time content hash value is matched and verified with the target content hash value.

[0078] It should be noted that the code editing processing device provided in the above embodiments is only illustrated by the division of the above functional modules when executing the code editing processing method. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the code editing processing device and the code editing processing method embodiments provided in the above embodiments belong to the same concept, and the implementation process is detailed in the method embodiments, which will not be repeated here.

[0079] The example numbers in this specification are for descriptive purposes only and do not represent the superiority or inferiority of the examples.

[0080] In the embodiments of this specification, a technical means is used to monitor code editing requests carrying target line-level content hash tags including target line number and target content hash value. After initially locating the target code line based on the target line number, the real-time content hash value of the code line is pre-calculated and verified to see if it matches the target content hash value. The code editing operation is only performed when the verification is successful. This effectively solves the technical problems in the prior art where artificial intelligence code agents rely solely on static line numbers for code editing, such as positioning failure, misaligned overwriting, and large-scale code pollution caused by line number offset due to multiple rounds of concurrent modifications or collaborative tasks. The traditional pure location-dependent addressing method is upgraded to a dual strong binding verification of spatial location and content fingerprint. This enables the system to perceive and intercept dirty data and expired context, freeing it from the static dependence of the automated editing process on the stability of absolute line numbers. Even in complex, high-frequency multi-human collaborative development environments, it can ensure that every editing instruction of the code agent is accurately implemented in the expected original semantic context, thereby improving the modification accuracy, concurrency safety boundary, and editing success rate of artificial intelligence-assisted programming.

[0081] This specification also provides a computer storage medium that can store multiple instructions adapted to be loaded and executed by a processor as described above. Figures 1-3 The code editing processing method described in the illustrated embodiment can be found in the following document for a detailed execution process: Figures 1-3 The specific details of the illustrated embodiments will not be elaborated here.

[0082] This specification also provides a computer program product that stores at least one instruction, said at least one instruction being loaded and executed by the processor as described above. Figures 1-3 The code editing processing method described in the illustrated embodiment can be found in the following document for a detailed execution process: Figures 1-3 The specific details of the illustrated embodiments will not be elaborated here.

[0083] Please refer to Figure 5 This is a structural block diagram of an electronic device provided in an embodiment of this specification. The electronic device in this specification may include one or more of the following components: a processor 1010, a memory 1020, an input device 1030, an output device 1040, and a bus 1050. The processor 1010, memory 1020, input device 1030, and output device 1040 may be connected to each other via the bus 1050.

[0084] Processor 1010 may include one or more processing cores. Processor 1010 connects to various parts of the electronic device using various interfaces and lines, and performs various functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in memory 1020, and by calling data stored in memory 1020. Optionally, processor 1010 may be implemented using at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), or programmable logic array (PLA). Processor 1010 may integrate one or a combination of central processing unit (CPU), graphics processing unit (GPU), and modem. The CPU mainly handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the displayed content; and the modem is used for wireless communication. It is understood that the modem may also not be integrated into processor 1010 and may be implemented separately through a communication chip.

[0085] The memory 1020 may include random access memory (RAM) or read-only memory (ROM). Optionally, the memory 1020 may include non-transitory computer-readable storage medium. The memory 1020 may be used to store instructions, programs, code, code sets, or instruction sets.

[0086] The input device 1030 is used to receive input instructions or data, and the input device 1030 includes, but is not limited to, a keyboard, mouse, camera, microphone, or touch device. The output device 1040 is used to output instructions or data, and the output device 1040 includes, but is not limited to, display devices and speakers.

[0087] In addition, those skilled in the art will understand that the structure of the electronic device shown in the above figures does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements. For example, the electronic device may also include radio frequency circuits, input units, sensors, audio circuits, wireless fidelity (Wi-Fi) modules, power supplies, Bluetooth modules, etc., which will not be described in detail here.

[0088] In the embodiments of this specification, the executing entity for each step can be the electronic device described above. Optionally, the executing entity for each step can be the operating system of the electronic device. The operating system can be Android, iOS, or other operating systems; this specification does not limit this.

[0089] exist Figure 5 In the electronic device, the processor 1010 can be used to call a program stored in the memory 1020 and execute it to implement the code editing processing method as described in the various method embodiments of this specification, specifically: Monitor code editing requests initiated by code agents driven by a large code processing model for a target source code file; Determine the target line-level content hash tag for the target line of code carried in the code editing request, wherein the target line-level content hash tag includes the target line number and the target content hash value for the target line of code; Based on the target line number, locate the corresponding target line code in the target source code file and calculate the real-time content hash value corresponding to the target line code. Then, match and verify the real-time content hash value with the target content hash value. If the real-time content hash value matches the target content hash value, then code editing operations are performed on the target code line in the target source code file based on the code editing request.

[0090] In one embodiment, before executing the code editing request initiated by the code intelligence agent driven by the large code processing model for the target source code file, the processor 1010 also performs the following operations: The line code of the target source code file is parsed to obtain the line code content hash value. Based on the line code content hash value and the original code line number, a line-level content hash tag is generated that is bound to each line code. The target source code file carrying the line-level content hash tag is sent to a code agent driven by a large code processing model, instructing the code agent to generate a code editing request based on the line-level content hash tag when a code editing task exists.

[0091] In one embodiment, the processor 1010, after executing the content parsing of the line code of the target source code file to obtain the line code content hash value, generates a line-level content hash tag bound to each line code based on the line code content hash value and the original code line number, and performs the following operations: Perform a format removal operation on the parsed lines of code to obtain the core semantic text after removing code format noise; A preset hash algorithm is invoked to extract the digital fingerprint of the core semantic text and generate a hash value for the line code content; The hash value of the line code content is concatenated with the corresponding original line number using a preset separator to generate a line-level content hash tag.

[0092] In one embodiment, after performing the matching and verification between the real-time content hash value and the target content hash value, the processor 1010 further performs the following operations: If the real-time content hash value does not match the target content hash value, the code editing request is rejected and an exception message is generated for the target line of code; or, If the real-time content hash value is inconsistent with the target content hash value, then based on the target content hash value in the target line-level content hash tag, fault-tolerant addressing and positioning processing is performed within the preset line number offset range of the target source code file.

[0093] In one embodiment, the processor 1010 performs fault-tolerant addressing and positioning processing within a preset line number offset range of the target source code file based on the target content hash value in the target line-level content hash tag, and performs the following operations: Using the target row number as the central reference point, construct a sliding search window that extends upwards and / or downwards; Calculate the candidate real-time hash value of the candidate line code in the sliding search window line by line, and match and verify the candidate real-time hash value with the target content hash value; If a matching candidate real-time hash value is found in the sliding search window, the real-time candidate line corresponding to the matching candidate real-time hash value is redefined as the target code line, and the step of performing code editing operation on the target code line in the target source code file based on the code editing request is triggered. If no matching alternative real-time hash value is found within the sliding search window, the code editing request is rejected and an exception message is generated for the target line of code.

[0094] In one embodiment, after executing the code editing operation on the target code lines in the target source code file based on the code editing request, the processor 1010 further performs the following operations: If the code editing operation is an insertion and / or replacement operation, then the content hash value of the target line code after editing is determined and the line-level content hash label of the target line code is updated based on the content hash value, and the label line number parameter is incrementally updated for the subsequent line code located after the target line code that is affected by the line number offset. If the code editing operation is a deletion operation, then the line-level content hash tag corresponding to the target code line is removed, and the tag line number parameter is corrected for the subsequent lines of code affected by the line number offset after the target code line.

[0095] In one embodiment, the code editing request is a batch editing request comprising multiple sequentially arranged code editing operations. Before executing the step of locating the target line code corresponding to the target source code file based on the target line number and calculating the real-time content hash value corresponding to the target line code, the processor 1010 also performs the following operations: Construct a virtual execution state tree for the target source code file, and simulate the execution of the code editing operations in sequence according to the order of the code editing operations; Monitor the line number change parameters caused by the preceding code editing operation in the virtual execution state tree, and deduce the theoretical line number offset caused by it to subsequent code editing operations; Based on the theoretical line number offset, the line number parameter of the target line-level content hash tag carried by subsequent code editing operations in the batch editing request is repaired. Based on the repaired line number parameter, the corresponding target line code in the target source code file is located based on the target line number, and the real-time content hash value corresponding to the target line code is calculated. The real-time content hash value is matched and verified with the target content hash value.

[0096] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory, or random access memory, etc.

[0097] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.), and signals involved in the embodiments of this specification are all authorized by the user or fully authorized by all parties, and the collection, use, and processing of related data must comply with the relevant laws, regulations, and standards of the relevant countries and regions. For example, the data, information, and features involved in this specification were all obtained under full authorization.

[0098] The above-disclosed embodiments are merely preferred embodiments of this specification and should not be construed as limiting the scope of this specification. Therefore, any equivalent variations made in accordance with the claims of this specification shall still fall within the scope of this specification.

Claims

1. A code editing and processing method, characterized in that, The method includes: Monitor code editing requests initiated by code agents driven by a large code processing model for a target source code file; Determine the target line-level content hash tag for the target line of code carried in the code editing request, wherein the target line-level content hash tag includes the target line number and the target content hash value for the target line of code; Based on the target line number, locate the corresponding target line code in the target source code file and calculate the real-time content hash value corresponding to the target line code. Then, match and verify the real-time content hash value with the target content hash value. If the real-time content hash value matches the target content hash value, then code editing operations are performed on the target code line in the target source code file based on the code editing request.

2. The method according to claim 1, characterized in that, The monitoring process, which is based on a large code processing model-driven code intelligence agent, includes the following steps before initiating a code editing request for the target source code file: The line code of the target source code file is parsed to obtain the line code content hash value. Based on the line code content hash value and the original code line number, a line-level content hash tag is generated that is bound to each line code. The target source code file carrying the line-level content hash tag is sent to a code agent driven by a large code processing model, instructing the code agent to generate a code editing request based on the line-level content hash tag when a code editing task exists.

3. The method according to claim 2, characterized in that, The process of parsing the line code of the target source code file to obtain line code content hash values, and generating line-level content hash tags bound to each line code based on the line code content hash values ​​and the original code line numbers, includes: Perform a format removal operation on the parsed lines of code to obtain the core semantic text after removing code format noise; A preset hash algorithm is invoked to extract the digital fingerprint of the core semantic text and generate a hash value for the line code content; The hash value of the line code content is concatenated with the corresponding original line number using a preset separator to generate a line-level content hash tag.

4. The method according to claim 1, characterized in that, After matching and verifying the real-time content hash value with the target content hash value, the method further includes: If the real-time content hash value does not match the target content hash value, the code editing request is rejected and an exception message is generated for the target line of code; or, If the real-time content hash value is inconsistent with the target content hash value, then based on the target content hash value in the target line-level content hash tag, fault-tolerant addressing and positioning processing is performed within the preset line number offset range of the target source code file.

5. The method according to claim 4, characterized in that, The step of performing fault-tolerant addressing and location processing within a preset line number offset range of the target source code file based on the target content hash value in the target line-level content hash tag includes: Using the target row number as the central reference point, construct a sliding search window that extends upwards and / or downwards; Calculate the candidate real-time hash value of the candidate line code in the sliding search window line by line, and match and verify the candidate real-time hash value with the target content hash value; If a matching candidate real-time hash value is found in the sliding search window, the real-time candidate line corresponding to the matching candidate real-time hash value is redefined as the target code line, and the step of performing code editing operation on the target code line in the target source code file based on the code editing request is triggered. If no matching alternative real-time hash value is found within the sliding search window, the code editing request is rejected and an exception message is generated for the target line of code.

6. The method according to claim 1, characterized in that, After performing code editing operations on the target code lines in the target source code file based on the code editing request, the method further includes: If the code editing operation is an insertion and / or replacement operation, then the content hash value of the target line code after editing is determined and the line-level content hash label of the target line code is updated based on the content hash value, and the label line number parameter is incrementally updated for the subsequent line code located after the target line code that is affected by the line number offset. If the code editing operation is a deletion operation, then the line-level content hash tag corresponding to the target code line is removed, and the tag line number parameter is corrected for the subsequent lines of code affected by the line number offset after the target code line.

7. The method according to claim 1, characterized in that, The code editing request is a batch editing request that includes multiple code editing operations arranged in sequence. Before locating the corresponding target line code in the target source code file based on the target line number and calculating the real-time content hash value corresponding to the target line code, the method further includes: Construct a virtual execution state tree for the target source code file, and simulate the execution of the code editing operations in sequence according to the order of the code editing operations; Monitor the line number change parameters caused by the preceding code editing operation in the virtual execution state tree, and deduce the theoretical line number offset caused by it to subsequent code editing operations; Based on the theoretical line number offset, the line number parameter of the target line-level content hash tag carried by subsequent code editing operations in the batch editing request is repaired. Based on the repaired line number parameter, the corresponding target line code in the target source code file is located based on the target line number, and the real-time content hash value corresponding to the target line code is calculated. The real-time content hash value is matched and verified with the target content hash value.

8. A code editing and processing device, characterized in that, The device includes: The monitoring module is used to monitor code editing requests initiated by code intelligence agents driven by a large code processing model for the target source code file. The monitoring module is used to determine the target line-level content hash tag for the target line of code carried in the code editing request. The target line-level content hash tag includes the target line number and the target content hash value for the target line of code. The verification module is used to locate the target line code in the target source code file based on the target line number and calculate the real-time content hash value corresponding to the target line code, and match and verify the real-time content hash value with the target content hash value; The operation module is used to perform code editing operations on the target code line in the target source code file based on the code editing request if the real-time content hash value matches the target content hash value.

9. A computer storage medium, characterized in that, The computer storage medium stores a plurality of instructions adapted for loading by a processor and executing the steps of the method as described in any one of claims 1 to 7.

10. A computer program product, characterized in that, The computer program product stores at least one instruction, which is loaded by a processor and executed according to any one of claims 1 to 7.

11. An electronic device, characterized in that, include: A processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to execute the steps of the method as described in any one of claims 1 to 7.