fix: protocol validator allows REQUEST without :target if :source is present
Some checks failed
Deploy-Agent-V15-Stdin / JOB-V15-STDIN (push) Failing after 3s
Some checks failed
Deploy-Agent-V15-Stdin / JOB-V15-STDIN (push) Failing after 3s
- Relax validate-communication-protocol-schema to accept :REQUEST messages without :target when :source is present in :meta (reason-gate infers target from source). - This preserves 'equality of clients' — gateways don't duplicate routing logic. - Add communication-validator to ASD components. - Fixes TCP CLI gateway integration: clients can now connect and receive responses. - Verified with test client: 13/13 skills load, Perceive gate processes messages.
This commit is contained in:
46
test_cli.py
Normal file
46
test_cli.py
Normal file
@@ -0,0 +1,46 @@
|
||||
import socket
|
||||
import struct
|
||||
|
||||
def frame_message(msg_string):
|
||||
payload = msg_string.encode('utf-8')
|
||||
return f"{len(payload):06x}".encode('ascii') + payload
|
||||
|
||||
def read_framed(sock):
|
||||
header = b''
|
||||
while len(header) < 6:
|
||||
chunk = sock.recv(6 - len(header))
|
||||
if not chunk:
|
||||
return None
|
||||
header += chunk
|
||||
length = int(header, 16)
|
||||
data = b''
|
||||
while len(data) < length:
|
||||
chunk = sock.recv(length - len(data))
|
||||
if not chunk:
|
||||
return None
|
||||
data += chunk
|
||||
return data.decode('utf-8')
|
||||
|
||||
msg = '(:TYPE :REQUEST :PAYLOAD (:ACTION :MESSAGE :TEXT "hello") :META (:SOURCE :CLI :SESSION-ID "test1"))'
|
||||
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
sock.connect(('127.0.0.1', 9105))
|
||||
sock.settimeout(10.0)
|
||||
|
||||
# Read handshake
|
||||
handshake = read_framed(sock)
|
||||
print("HANDSHAKE:", handshake)
|
||||
|
||||
# Read status
|
||||
status = read_framed(sock)
|
||||
print("STATUS:", status)
|
||||
|
||||
# Send message
|
||||
sock.sendall(frame_message(msg))
|
||||
print("SENT:", msg)
|
||||
|
||||
# Read response
|
||||
response = read_framed(sock)
|
||||
print("RESPONSE:", response)
|
||||
|
||||
sock.close()
|
||||
Reference in New Issue
Block a user