cr-proc 0.1.5__tar.gz → 0.1.6__tar.gz
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.
- {cr_proc-0.1.5 → cr_proc-0.1.6}/PKG-INFO +1 -1
- {cr_proc-0.1.5 → cr_proc-0.1.6}/pyproject.toml +1 -1
- {cr_proc-0.1.5 → cr_proc-0.1.6}/src/code_recorder_processor/api/verify.py +14 -0
- {cr_proc-0.1.5 → cr_proc-0.1.6}/src/code_recorder_processor/cli.py +36 -2
- {cr_proc-0.1.5 → cr_proc-0.1.6}/README.md +0 -0
- {cr_proc-0.1.5 → cr_proc-0.1.6}/src/code_recorder_processor/__init__.py +0 -0
- {cr_proc-0.1.5 → cr_proc-0.1.6}/src/code_recorder_processor/api/build.py +0 -0
- {cr_proc-0.1.5 → cr_proc-0.1.6}/src/code_recorder_processor/api/load.py +0 -0
|
@@ -313,6 +313,19 @@ def _detect_rapid_paste_sequences(jsonData: tuple[dict[str, Any], ...]) -> list[
|
|
|
313
313
|
# If we found 3+ one-line pastes within 1 second, flag it
|
|
314
314
|
if len(cluster) >= 3:
|
|
315
315
|
event_indices = [p["event_index"] for p in cluster]
|
|
316
|
+
|
|
317
|
+
# Build detailed events list for optional detailed review
|
|
318
|
+
detailed_events = []
|
|
319
|
+
for paste in cluster:
|
|
320
|
+
idx = paste["event_index"]
|
|
321
|
+
content = paste["content"]
|
|
322
|
+
detailed_events.append({
|
|
323
|
+
"event_index": idx,
|
|
324
|
+
"line_count": 1,
|
|
325
|
+
"char_count": len(content),
|
|
326
|
+
"newFragment": content,
|
|
327
|
+
})
|
|
328
|
+
|
|
316
329
|
suspicious_events.append({
|
|
317
330
|
"event_index": event_indices[0],
|
|
318
331
|
"event_indices": event_indices,
|
|
@@ -320,6 +333,7 @@ def _detect_rapid_paste_sequences(jsonData: tuple[dict[str, Any], ...]) -> list[
|
|
|
320
333
|
"char_count": sum(len(p["content"]) for p in cluster),
|
|
321
334
|
"reason": "rapid one-line pastes (AI indicator)",
|
|
322
335
|
"newFragment": f"{len(cluster)} one-line pastes in 1 second",
|
|
336
|
+
"detailed_events": detailed_events,
|
|
323
337
|
})
|
|
324
338
|
|
|
325
339
|
i = j if j > i + 1 else i + 1
|
|
@@ -190,7 +190,29 @@ def display_suspicious_event(event: dict[str, Any], show_details: bool) -> None:
|
|
|
190
190
|
print(f" {line}", file=sys.stderr)
|
|
191
191
|
print(" ```", file=sys.stderr)
|
|
192
192
|
|
|
193
|
+
elif "event_indices" in event and reason == "rapid one-line pastes (AI indicator)":
|
|
194
|
+
# Rapid paste sequences (AI indicator) - show aggregate style
|
|
195
|
+
indices = event["event_indices"]
|
|
196
|
+
print(
|
|
197
|
+
f" AI Rapid Paste: Events #{indices[0]}-#{indices[-1]} "
|
|
198
|
+
f"({event['line_count']} lines, {event['char_count']} chars, "
|
|
199
|
+
f"{len(indices)} events in < 1 second)",
|
|
200
|
+
file=sys.stderr,
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
if show_details and "detailed_events" in event:
|
|
204
|
+
# Combine all detailed events into one block
|
|
205
|
+
combined_content = "".join(
|
|
206
|
+
detail["newFragment"] for detail in event["detailed_events"]
|
|
207
|
+
)
|
|
208
|
+
print(" Combined output:", file=sys.stderr)
|
|
209
|
+
print(" ```", file=sys.stderr)
|
|
210
|
+
for line in combined_content.split("\n"):
|
|
211
|
+
print(f" {line}", file=sys.stderr)
|
|
212
|
+
print(" ```", file=sys.stderr)
|
|
213
|
+
|
|
193
214
|
elif "event_indices" in event:
|
|
215
|
+
# Other multi-event clusters
|
|
194
216
|
indices = event.get("event_indices", [event["event_index"]])
|
|
195
217
|
print(
|
|
196
218
|
f" Events #{indices[0]}-#{indices[-1]} ({reason}): "
|
|
@@ -222,8 +244,20 @@ def display_suspicious_events(
|
|
|
222
244
|
Whether to show detailed autocomplete events
|
|
223
245
|
"""
|
|
224
246
|
if suspicious_events:
|
|
225
|
-
print("\nSuspicious
|
|
226
|
-
|
|
247
|
+
print("\nSuspicious events detected:", file=sys.stderr)
|
|
248
|
+
|
|
249
|
+
# Sort events by their index for chronological display
|
|
250
|
+
def get_sort_key(event: dict[str, Any]) -> int | float:
|
|
251
|
+
if "event_indices" in event and event["event_indices"]:
|
|
252
|
+
return event["event_indices"][0]
|
|
253
|
+
if "detailed_events" in event and event["detailed_events"]:
|
|
254
|
+
return event["detailed_events"][0].get("event_index", float("inf"))
|
|
255
|
+
event_idx = event.get("event_index", -1)
|
|
256
|
+
return event_idx if event_idx >= 0 else float("inf")
|
|
257
|
+
|
|
258
|
+
sorted_events = sorted(suspicious_events, key=get_sort_key)
|
|
259
|
+
|
|
260
|
+
for event in sorted_events:
|
|
227
261
|
display_suspicious_event(event, show_details)
|
|
228
262
|
else:
|
|
229
263
|
print("Success! No suspicious events detected.", file=sys.stderr)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|