Class: Gaggle::Goose

Inherits:
ApplicationRecord show all
Includes:
PersonalityDefaults
Defined in:
app/models/gaggle/goose.rb

Defined Under Namespace

Modules: PersonalityDefaults

Constant Summary collapse

SERVER_URL =
"http://localhost:60053"

Instance Method Summary collapse

Instance Method Details

#begin_promptObject



77
78
79
80
81
# File 'app/models/gaggle/goose.rb', line 77

def begin_prompt
  "    Begin by reading the available channels and responding where necessary\n  TEXT\nend\n"

#interaction_promptObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'app/models/gaggle/goose.rb', line 22

def interaction_prompt
  "    In addition to your primary role, you must communicate with other AI assistants and the gaggle MCP tools.\n    Do not forget this: Your unique goose_id is \#{id}. This id will let you know which messages are yours vs others.\n    Do not forget your name is \#{name}.\n    Remember: The Human can only communicate through messages, so no need to put a thoughts in the console.\n\n    Gaggle is a chat board style interface with channels to communicate and messages to send.\n\n    Here is the flow for working in the system\n\n    ```mermaid\n      graph TD\n        A[Start] --> B[Check Existing Channels]\n        B --> C{Anyone Needs a Response?}\n        C -->|Yes| D[Respond to Relevant Messages]\n        C -->|No| E[Perform Tasks Needing Resumption]\n        D --> E\n        E --> F[Check for Notifications]\n        F -->|Yes| G[Check Channel for Notification]\n        G --> H{Message Relevant?}\n        H -->|Yes| I{Need to Respond?}\n        I -->|Yes| J[Respond to Notification]\n        I -->|No| K[End]\n        H -->|No| K\n        F -->|No| K\n        K[End - Wait for Next Notification]\n    ```\n\n    Here is how to manage bugs:\n\n    ```mermaid\n      graph TD\n        A[Start] --> B{Hit a Bug or Issue?}\n        B -->|Yes| C[Choose Action]\n        C --> D{Ask in Relevant Channel}\n        C --> E{Create Relevant Channel}\n        D --> F[Post Bug/Issue Details]\n        E --> F\n        F --> G[Wait for Human Response]\n        B -->|No| H{Want to Delete Channel?}\n        H -->|Yes| I[Confirm Deletion in Channel]\n        I --> J[Wait for Human Confirmation]\n        J -->|Confirmed| K[Delete Channel]\n        J -->|Not Confirmed| L[Keep Channel]\n        H -->|No| M[Continue Monitoring]\n        G --> M\n        K --> M\n        L --> M\n      ```\n\n    DO NOT FORGET: Whenever you are trying to interact with the system, use the gaggle MCP tools.\n  TEXT\nend\n"

#notify_of_message(notification:) ⇒ Object



83
84
85
86
87
88
89
90
91
92
# File 'app/models/gaggle/goose.rb', line 83

def notify_of_message(notification:)
  Rails.logger.info "Notifying goose of message: #{notification.message_id}"
  if session = sessions.running.first
    session.write_to_executable("Automated: You have a new message in #{notification.messageable_type}: #{notification.messageable_id}. Please respond")
    true
  else
    Rails.logger.error "No running sessions found for goose: #{id}"
    false
  end
end

#private_channel(goose) ⇒ Object



18
19
20
# File 'app/models/gaggle/goose.rb', line 18

def private_channel(goose)
  Gaggle::Message.where(messageable: self, goose:).or(Gaggle::Message.where(messageable: goose, goose: self))
end