feat: add dir
This commit is contained in:
1 parent
ba27d7c095
commit
ded26ce300
8 files changed
+67
No files matched your search
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
@@ -0,0 +1,27 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Echo memory after_turn hook — demo plugin.
|
||||||
|
|
||||||
|
Logs the number of messages in the conversation after each turn.
|
||||||
|
|
||||||
|
Receives via stdin:
|
||||||
|
{"type": "after_turn", "agent_id": "...", "messages": [...]}
|
||||||
|
|
||||||
|
Prints to stdout:
|
||||||
|
{"type": "ok"}
|
||||||
|
"""
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
request = json.loads(sys.stdin.read())
|
||||||
|
agent_id = request.get("agent_id", "unknown")
|
||||||
|
messages = request.get("messages", [])
|
||||||
|
|
||||||
|
# In a real plugin you might update an index or persist state here.
|
||||||
|
# For this demo we just acknowledge.
|
||||||
|
print(json.dumps({"type": "ok"}), flush=True)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Echo memory ingest hook — demo plugin.
|
||||||
|
|
||||||
|
Echoes the user message back as a "recalled memory" to verify
|
||||||
|
the plugin system works end-to-end.
|
||||||
|
|
||||||
|
Receives via stdin:
|
||||||
|
{"type": "ingest", "agent_id": "...", "message": "user message text"}
|
||||||
|
|
||||||
|
Prints to stdout:
|
||||||
|
{"type": "ingest_result", "memories": [{"content": "..."}]}
|
||||||
|
"""
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
request = json.loads(sys.stdin.read())
|
||||||
|
message = request.get("message", "")
|
||||||
|
agent_id = request.get("agent_id", "unknown")
|
||||||
|
|
||||||
|
memories = [
|
||||||
|
{"content": f"[echo-memory] Agent {agent_id} received: {message[:200]}"}
|
||||||
|
]
|
||||||
|
|
||||||
|
result = {"type": "ingest_result", "memories": memories}
|
||||||
|
print(json.dumps(result))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
name = "echo-memory"
|
||||||
|
version = "0.1.0"
|
||||||
|
description = "Simple demo plugin that echoes back the user message as a 'recalled memory'"
|
||||||
|
author = "librefang"
|
||||||
|
|
||||||
|
[hooks]
|
||||||
|
ingest = "hooks/ingest.py"
|
||||||
|
after_turn = "hooks/after_turn.py"
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
# No external dependencies — uses only Python stdlib
|
||||||
Whitespace-only changes.
Reference in new issue
Block a user