mirror of
https://github.com/lukaszraczylo/claude-mnemonic.git
synced 2026-06-16 02:51:45 +00:00
Merge origin/main into mnemonic-ralphised
Resolved conflicts in: - internal/config/config.go: Combined new bool fields with maintenance settings - internal/db/gorm/models.go: Merged field reordering with archival fields - internal/mcp/server.go: Merged field reordering with maintenanceService - internal/search/manager.go: Updated Metadata field to use 'any' type - internal/worker/handlers.go: Kept HEAD version - internal/worker/sdk/processor.go: Combined circuit breaker/dedup with claude path - internal/worker/service.go: Kept HEAD version - ui/src/components/Sidebar.vue: Combined new components with useGraphMetrics - ui/src/utils/api.ts: Combined new APIs with graph/vector metrics
This commit is contained in:
@@ -18,12 +18,12 @@ type Input struct {
|
||||
|
||||
// Observation represents an observation from the API.
|
||||
type Observation struct {
|
||||
ID int64 `json:"id"`
|
||||
Type string `json:"type"`
|
||||
Title string `json:"title"`
|
||||
Subtitle string `json:"subtitle"`
|
||||
Narrative string `json:"narrative"`
|
||||
Facts []string `json:"facts"`
|
||||
ID int64 `json:"id"`
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
@@ -43,21 +43,21 @@ type StatusInput struct {
|
||||
|
||||
// WorkerStats is the response from the worker's /api/stats endpoint.
|
||||
type WorkerStats struct {
|
||||
Uptime string `json:"uptime"`
|
||||
ActiveSessions int `json:"activeSessions"`
|
||||
QueueDepth int `json:"queueDepth"`
|
||||
IsProcessing bool `json:"isProcessing"`
|
||||
ConnectedClients int `json:"connectedClients"`
|
||||
SessionsToday int `json:"sessionsToday"`
|
||||
Ready bool `json:"ready"`
|
||||
Project string `json:"project,omitempty"`
|
||||
ProjectObservations int `json:"projectObservations,omitempty"`
|
||||
Retrieval struct {
|
||||
Uptime string `json:"uptime"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Retrieval struct {
|
||||
TotalRequests int64 `json:"TotalRequests"`
|
||||
ObservationsServed int64 `json:"ObservationsServed"`
|
||||
SearchRequests int64 `json:"SearchRequests"`
|
||||
ContextInjections int64 `json:"ContextInjections"`
|
||||
} `json:"retrieval"`
|
||||
ActiveSessions int `json:"activeSessions"`
|
||||
QueueDepth int `json:"queueDepth"`
|
||||
ConnectedClients int `json:"connectedClients"`
|
||||
SessionsToday int `json:"sessionsToday"`
|
||||
ProjectObservations int `json:"projectObservations,omitempty"`
|
||||
IsProcessing bool `json:"isProcessing"`
|
||||
Ready bool `json:"ready"`
|
||||
}
|
||||
|
||||
// ANSI color codes
|
||||
|
||||
@@ -14,17 +14,17 @@ import (
|
||||
// Input is the hook input from Claude Code.
|
||||
type Input struct {
|
||||
hooks.BaseInput
|
||||
StopHookActive bool `json:"stop_hook_active"`
|
||||
TranscriptPath string `json:"transcript_path"`
|
||||
StopHookActive bool `json:"stop_hook_active"`
|
||||
}
|
||||
|
||||
// TranscriptMessage represents a message in the transcript JSONL file.
|
||||
type TranscriptMessage struct {
|
||||
Type string `json:"type"`
|
||||
Message struct {
|
||||
Content any `json:"content"`
|
||||
Role string `json:"role"`
|
||||
Content any `json:"content"` // Can be string or array
|
||||
} `json:"message"`
|
||||
Type string `json:"type"` // Can be string or array
|
||||
}
|
||||
|
||||
// extractTextContent extracts text content from message content (handles both string and array formats).
|
||||
|
||||
@@ -94,8 +94,18 @@ func handleUserPrompt(ctx *hooks.HookContext, input *Input) (string, error) {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
sessionID := int64(result["sessionDbId"].(float64))
|
||||
promptNumber := int(result["promptNumber"].(float64))
|
||||
// Safely extract session ID and prompt number with type checking
|
||||
sessionDbIdRaw, ok := result["sessionDbId"].(float64)
|
||||
if !ok {
|
||||
return "", fmt.Errorf("invalid or missing sessionDbId in response")
|
||||
}
|
||||
sessionID := int64(sessionDbIdRaw)
|
||||
|
||||
promptNumberRaw, ok := result["promptNumber"].(float64)
|
||||
if !ok {
|
||||
return "", fmt.Errorf("invalid or missing promptNumber in response")
|
||||
}
|
||||
promptNumber := int(promptNumberRaw)
|
||||
|
||||
fmt.Fprintf(os.Stderr, "[user-prompt] Session %d, prompt #%d\n", sessionID, promptNumber)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user