Added stop signals to RMASS incoming message flows. Nested attachment handling in its own operation for Synapse outgoing message flows

This commit is contained in:
Lyncoln
2026-10-26 15:17:45 -04:00
parent b9f36eff0a
commit 2b7435527a
19 changed files with 202 additions and 21 deletions
+3
View File
@@ -16,6 +16,9 @@ def buildOperation(definition, outputs):
dependency in outputs["stopsignals"]
for dependency in action.depends
)
#print(f"STOP SIGNAL DEBUGGING during {action.name}")
#print(outputs["stopsignals"])
#stop = True
#break
+7
View File
@@ -1,3 +1,4 @@
from core.execution import action
from core.execution.action.action import buildAction
from core.runtime.runtimecontract import buildPreRuntimeAttr, buildRuntimeAttr
from core.apirequest import executeRequest
@@ -33,15 +34,21 @@ def buildRecursive(definition, outputs):
dependency in outputs["stopsignals"]
for dependency in job.depends
)
#print(f"STOP SIGNAL DEBUGGING during {job.name}")
#print(outputs["stopsignals"])
#stop = True
#break
if stop:
#print("STOP SIGNAL DETECTED")
#print(f"Stopping {job.name} due to stop signal")
continue
#print(f"RECURSIVE DEBUG DURING {job.name}")
#print(item)
#outputs, response = buildAction(job, outputs)
outputs, response = executeContract(job, outputs)
responses.append(response)
+3 -1
View File
@@ -4,7 +4,9 @@ name = "Get User Avatar"
kind = "action"
alias = "getavatar"
alias = "getrmassuseravatar"
depends = []
allowaction = bool(os.environ.get("UPDATE_AVATARS", True))
+1 -1
View File
@@ -4,7 +4,7 @@ name = "Get message list"
kind = "action"
alias = "pullmessages"
alias = "pullmessagelist"
showstatus = True
+7 -7
View File
@@ -48,17 +48,17 @@ resolve = {
}
keys = [
#{
# "keytitle": "message",
# "keyvalue": {
# "resolved": "message_body",
# },
#},
{
"keytitle": "message",
"keyvalue": "Here's a photo!",
"keyvalue": {
"resolved": "message_body",
},
},
#{
# "keytitle": "message",
# "keyvalue": "Here's a photo!",
#},
#{
# "keytitle": "profileId",
# "keyvalue": {
# "resolved": "rmass_user",
@@ -2,7 +2,11 @@ name = "Upload Attachments to Synapse"
kind = "action"
alias = "uploadattachment"
alias = "rmassuploadattachmenttosynapse"
depends = [
"getrmassattachments",
]
showstatus = True
@@ -4,7 +4,11 @@ name = "Upload Avatar to Synapse"
kind = "action"
alias = "uploadavatar"
alias = "rmassavatartosynapse"
depends = [
"getrmassuseravatar",
]
allowaction = os.environ.get("UPDATE_AVATARS", True)
@@ -0,0 +1,94 @@
name = "Save RMASS Message ID"
kind = "action"
alias = "savermassmessageid"
depends = [
"synapsegetroomalias",
"rmassmessagepush",
"rmassattachmentpush",
]
showstatus = True
isrequest = True
method = "GET"
#Used to resolve path for recursive handling. Path location must match the location of the recursiveset data from pullmessage operation
resolve = {
"get": {
"event_id": ["outmessageitem", "event_id"],
"path": ["lastmessage", 0, "content", "com.loxthelion.rmass_message_id"],
#"matrix_sender": ["outmessageitem", "sender"],
#"msg_type": ["outmessageitem", "type"],
#"echo_tag": ["outmessageitem", "content", "com.loxthelion.rmass_message_id"],
"rmass_sent_status": ["rmass_sent_status"],
},
}
#To add resolution suffix, second item must be a dictionary. References the "path" library under resolved
path = [
"https://rentmasseur.com/api/v1/mailbox/",
{"resolved": "path"},
]
headers = {
"Authorization": {
"output": "access_token",
"prefix": "Bearer ",
},
}
outputs = {
"rmasslastmessages": "messages",
}
extract = {
"get": {
"rmass_message_id": ["rmasslastmessages", 0, "id"],
},
}
#outputs["rmasslastmessages"][0]["id"] is where we get our messageid
select = {
"source": "rmasslastmessages",
"include": {
"key": "senderId",
"value": 238302,
},
"exclude": {
"key": "currentFolder",
"value": 1,
}
}
saverow = {
"table": "message_mapping",
"columns": [
{"rmass_message_id": "INTEGER PRIMARY KEY"},
{"matrix_event_id": "TEXT NOT NULL UNIQUE"},
],
"rowitems": [
{"outputs": "rmass_message_id"},
{"resolved": "event_id"},
],
}
filters = [
{
"filterkey": "rmass_sent_status",
"operator": "==",
"filtervalue": "fail",
"print": f"Failed to send message to RMASS. Bypassing save during {name}...",
},
{
"filterkey": "rmass_sent_status",
"operator": "==",
"filtervalue": "error",
"print": f"Failed to send message to RMASS. Bypassing save during {name}...",
},
]
@@ -2,6 +2,13 @@ import os
name = "Synapse Assign Avatar"
alias = "synapseassignavatar"
depends = [
"getrmassuseravatar",
"rmassavatartosynapse",
]
kind = "action"
showstatus = True
@@ -2,6 +2,15 @@ import os
name = "Synapse Assign DM Room Avatar"
alias = "synapseassigndmavatar"
depends = [
"getrmassuseravatar",
"rmassavatartosynapse",
"synapsegetroomid",
"synapsecreatedmroom",
]
kind = "action"
showstatus = True
@@ -6,6 +6,10 @@ kind = "action"
showstatus = True
alias = "synapseassignusername"
#depends = []
#astoken = os.environ["AS_TOKEN"]
resolve = {
@@ -6,6 +6,10 @@ kind = "action"
showstatus = True
alias = "synapsecreatedmroom"
depends = []
resolve = {
"get": {
"sender": ["messageheaders", "userCard", "id"],
@@ -6,7 +6,6 @@ kind = "action"
depends = [
"synapsegetroomalias",
"rmassmessagepush",
]
showstatus = True
@@ -4,6 +4,12 @@ name = "Synapse Get Room ID"
kind = "action"
alias = "synapsegetroomid"
#depends = [
# "synapsecreatedmroom",
#]
showstatus = True
resolve = {
@@ -2,6 +2,13 @@ from . import synapsenotify
name = "Synapse Attachment Push"
alias = "synapsepushattachments"
depends = [
"getrmassattachments",
"rmassattachmenttosynapse",
]
kind = "action"
showstatus = True
+4
View File
@@ -6,6 +6,10 @@ kind = "action"
showstatus = True
alias = "synapseregister"
#depends = []
resolve = {
"get": {
"sender": ["messageheaders", "userCard", "id"],
@@ -3,10 +3,16 @@ from plugins.rmass.operations import synapsepushmessageitems
name = "Get RMASS Conversations and Synapse Provisioning"
alias = "getrmassconversations"
depends = [
"pullmessagelist",
]
kind = "recursiveset"
recursiveset = {
"source": "pullmessages_select",
"source": "pullmessagelist_select",
"outputlabel": "messageheaders",
"actions": [
synapseregister,
@@ -0,0 +1,20 @@
from plugins.rmass.actions import rmassmessagepush, savermassmessageid, synapsegetroomalias, refresh_tokens, synapsegetlastmessage, synapsegetattachment, getrmassattachmenturl, synapseattachmenttormass, getrmassattachmentid, rmassattachmentpush
name = "RMASS Attachment Push"
alias = "rmassattachmentpushflow"
depends = [
"synapsegetroomalias",
"synapsegetlastmessage",
]
kind = "operation"
actions = [
synapsegetattachment,
getrmassattachmenturl,
synapseattachmenttormass,
getrmassattachmentid,
rmassattachmentpush,
]
+9 -8
View File
@@ -1,4 +1,5 @@
from plugins.rmass.actions import rmassmessagepush, synapsegetroomalias, refresh_tokens, synapsegetlastmessage, getrmassconversation, synapsegetattachment, getrmassattachmenturl, synapseattachmenttormass, getrmassattachmentid, rmassattachmentpush
from plugins.rmass.actions import rmassmessagepush, savermassmessageid, synapsegetroomalias, synapsegetlastmessage
from plugins.rmass.operations import rmassattachmentpushflow
name = "RMASS Message Push"
@@ -9,17 +10,17 @@ recursiveset = {
#"retain": False,
"outputlabel": "outmessageitem",
"actions": [
#refresh_tokens,
synapsegetroomalias,
rmassmessagepush,
synapsegetlastmessage,
synapsegetattachment,
getrmassattachmenturl,
synapseattachmenttormass,
getrmassattachmentid,
rmassattachmentpush,
#synapsegetattachment,
#getrmassattachmenturl,
#synapseattachmenttormass,
#getrmassattachmentid,
#rmassattachmentpush,
rmassattachmentpushflow,
#synapsegetlastmessage,
getrmassconversation,
savermassmessageid,
],
}