Reset master to testing content

This commit is contained in:
Storm Dragon committed 2026-10-25 01:57:54 -04:00
1 parent 0f2587b719
commit 42afa2a56c
1483 files changed
+145308 -938069

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
"""Private independent wire fixture. Not an SDK or installable tentacle."""
import json
import sys
active = False
for line in sys.stdin.buffer:
request = json.loads(line)
method = request["method"]
if method == "initialize":
initialization = request["params"]
result = {
"protocol": initialization["protocol"],
"session": initialization["session"],
"commands": [{"id": "echo", "title": "Echo text", "description": ""}],
}
elif method == "initialized":
active = True
continue
elif method == "shutdown":
break
elif method == "command.invoke" and active:
result = request["params"]["arguments"]
else:
sys.exit(2)
print(json.dumps({"jsonrpc": "2.0", "id": request["id"], "result": result}), flush=True)
+63
View File
@@ -0,0 +1,63 @@
"""Private cgroup fixture. Never run resource commands outside a bounded group."""
import json
import os
import time
allocations = []
for line in iter(input, None):
message = json.loads(line)
method = message["method"]
if method == "initialize":
params = message["params"]
result = {
"protocol": params["protocol"],
"session": params["session"],
"commands": [{"id": "echo", "title": "Resource fixture", "description": ""}],
}
elif method == "initialized":
continue
elif method == "shutdown":
break
elif method == "command.invoke":
action = message["params"]["arguments"].get("action", "location")
if action == "detach":
childPid = os.fork()
if childPid == 0:
os.setsid()
time.sleep(300)
os._exit(0)
# Synchronize with the detach; inherited stdout stays open.
while os.getsid(childPid) != childPid:
time.sleep(0.001)
result = childPid
elif action == "tasks":
childPids = []
for _ in range(96):
try:
childPid = os.fork()
except BlockingIOError:
break
if childPid == 0:
time.sleep(300)
os._exit(0)
childPids.append(childPid)
result = len(childPids)
elif action == "memory":
allocation = bytearray(message["params"]["arguments"]["bytes"])
for offset in range(0, len(allocation), 4096):
allocation[offset] = 1
allocations.append(allocation)
result = True
elif action == "cpu":
result = True
else:
with open("/proc/self/cgroup", encoding="ascii") as source:
result = source.read().strip()
else:
raise RuntimeError("Unexpected method")
print(json.dumps({"jsonrpc": "2.0", "id": message["id"], "result": result}), flush=True)
if method == "command.invoke" and action == "cpu":
while True:
pass
+41
View File
@@ -0,0 +1,41 @@
# Private conformance peer: author APIs only; no framing or lifecycle code.
import pathlib
import sys
import threading
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[3] / "sdk/python"))
from cthulhu_tentacle import Command, present, serve
started = threading.Event()
def echo(cancelled, arguments):
return arguments
def fail(cancelled, arguments):
raise RuntimeError("private handler details")
def large(cancelled, arguments):
return "x" * 65536
def wait(cancelled, arguments):
started.set()
cancelled.wait()
pathlib.Path(sys.argv[1]).write_text("cancelled")
def has_started(cancelled, arguments):
return started.wait(2)
commands = [Command("echo", "Echo", "", echo), Command("fail", "Fail", "", fail),
Command("large", "Large", "", large), Command("wait", "Wait", "", wait),
Command("started", "Started", "", has_started)]
if pathlib.Path(sys.argv[1]).name == "presentation":
commands.append(Command("present", "Present", "",
lambda cancelled, arguments: present(speech="Hello, é猫😀é", braille="Display é猫😀é", uninterruptible=True),
presentation=True))
serve(commands)
+20
View File
@@ -0,0 +1,20 @@
# Private reader-settings conformance peer; no backend or desktop access.
import pathlib
import sys
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[3] / "sdk/python"))
from cthulhu_tentacle import Command, serve
def echo(cancelled, arguments):
return arguments
extensions = {"pages": [{"id": "probe", "title": "Reader probe", "command": "echo",
"elements": [{"id": "text", "label": "Example text", "kind": 2}],
"values": {"text": {"text": "Initial"}}}],
"quick_settings": [{"id": "probe", "label": "Probe choice", "command": "echo",
"selected": "default", "options": [{"id": "default", "label": "Default"}]}]}
serve([Command("echo", "Reader probe", "Private fixture", echo,
presentation=True, interaction=True, reader=True),
Command("ordinary", "Ordinary probe", "Private fixture", echo)], extensions=extensions)