@quantiya/codevibe-claude-plugin 2.0.11 → 2.0.13

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.
@@ -25,33 +25,29 @@ EXIT_CODE=$?
25
25
 
26
26
  if [ $EXIT_CODE -eq 0 ]; then
27
27
  log "INFO" "SessionEnd event sent successfully"
28
+ else
29
+ log "ERROR" "Failed to send SessionEnd event (exit code: $EXIT_CODE)"
30
+ fi
28
31
 
29
- # Clean up session-specific files
30
- if [ -n "$SESSION_ID" ]; then
31
- PID_FILE="${CODEVIBE_TMPDIR}/codevibe-claude-${SESSION_ID}.pid"
32
- PORT_FILE="${CODEVIBE_TMPDIR}/codevibe-claude-${SESSION_ID}.port"
33
-
34
- # Kill the MCP server for this session
35
- if [ -f "$PID_FILE" ]; then
36
- PID=$(cat "$PID_FILE")
37
- if ps -p "$PID" > /dev/null 2>&1; then
38
- log "INFO" "Stopping MCP server for session $SESSION_ID (PID: $PID)"
39
- kill "$PID" 2>/dev/null || true
40
- fi
41
- rm -f "$PID_FILE"
32
+ # Local cleanup is independent of telemetry/backend delivery. A terminal-loss
33
+ # monitor can retire the hosted row before this hook's concurrent POST finishes,
34
+ # producing an expected non-200 response; exact owned files must still disappear.
35
+ if [ -n "$SESSION_ID" ]; then
36
+ PID_FILE="${CODEVIBE_TMPDIR}/codevibe-claude-${SESSION_ID}.pid"
37
+ PORT_FILE="${CODEVIBE_TMPDIR}/codevibe-claude-${SESSION_ID}.port"
38
+
39
+ if [ -f "$PID_FILE" ]; then
40
+ PID=$(cat "$PID_FILE")
41
+ if [[ "$PID" =~ ^[0-9]+$ ]]; then
42
+ _reap_codevibe_daemon_pid "$PID" "SessionEnd for $SESSION_ID"
42
43
  fi
43
-
44
- # Remove port file (should also be cleaned up by server, but just in case)
45
- rm -f "$PORT_FILE"
46
-
47
- # Remove sent UUIDs tracking file
48
- SENT_UUIDS_FILE="${CODEVIBE_TMPDIR}/codevibe-claude-sent-uuids-${SESSION_ID}.txt"
49
- rm -f "$SENT_UUIDS_FILE"
50
-
51
- log "INFO" "Session cleanup completed for $SESSION_ID"
44
+ rm -f "$PID_FILE"
52
45
  fi
53
- else
54
- log "ERROR" "Failed to send SessionEnd event (exit code: $EXIT_CODE)"
46
+
47
+ rm -f "$PORT_FILE"
48
+ SENT_UUIDS_FILE="${CODEVIBE_TMPDIR}/codevibe-claude-sent-uuids-${SESSION_ID}.txt"
49
+ rm -f "$SENT_UUIDS_FILE"
50
+ log "INFO" "Session cleanup completed for $SESSION_ID"
55
51
  fi
56
52
 
57
53
  # Hooks are best-effort telemetry. Never propagate send_to_mcp failures to
@@ -423,10 +423,12 @@ if [ -n "$EXISTING_SERVER_PORT" ]; then
423
423
  else
424
424
  # (#638 I1) APP failure: a real non-200 HTTP response — the daemon is live
425
425
  # and reachable, it just rejected this event, so the wedged-daemon reap does
426
- # not apply. Keep the original recovery: drop the mapping and fall through
427
- # to the plain ensure + send below.
428
- log "WARN" "Failed to send to existing server (exit: $CURL_EXIT, HTTP $HTTP_CODE), will start new one"
429
- rm -f "$MAPPING_FILE"
426
+ # not apply. Retain the verified instance mapping and stop this invocation.
427
+ # Deleting the mapping here can turn a resume/compaction application error
428
+ # into a second daemon for the same Claude instance. The next hook event can
429
+ # retry the same live daemon; only a later transport failure may replace it.
430
+ log "WARN" "SessionStart application failure from verified server (exit: $CURL_EXIT, HTTP $HTTP_CODE) — keeping daemon mapping; not relaunching"
431
+ exit 0
430
432
  fi
431
433
  fi
432
434
 
@@ -21,7 +21,7 @@ export type { Config, Environment } from './config';
21
21
  export { Logger, logger, createLogger } from './logger';
22
22
  export { parseInteractivePrompt, normalizeSnapshot, } from './prompt-parser';
23
23
  export type { ParsedInteractivePrompt, PromptKind, InteractivePromptOption, } from './prompt-parser';
24
- export { resumeOrCreateSession, prepareSessionEncryption, rekeySessionForNewDevices, startDeviceKeyWatcher, registerDeviceEncryptionKey, prepareEventTimestamp, _resetPrepareEventTimestampForTesting, } from './session';
24
+ export { resumeOrCreateSession, prepareSessionEncryption, rekeySessionForNewDevices, startDeviceKeyWatcher, registerDeviceEncryptionKey, RetiredSessionCannotReactivateError, isRetiredSessionCannotReactivateError, prepareEventTimestamp, _resetPrepareEventTimestampForTesting, } from './session';
25
25
  export type { ResumeOrCreateSessionInput, ResumeOrCreateSessionResult } from './session';
26
26
  export { detectInstalledAgents, pushDetectedAgents, V1_ORCHESTRATION_PROMPT_KIND, V1_ORCHESTRATION_OPTIONS, mapOptionNumberToUserDecisionKind, mapOptionToUserDecisionKind, } from './orchestration';
27
27
  export type { DetectableAgent, V1OrchestrationOption, V1UserDecisionKind, } from './orchestration';