Operator
Orang atau tim yang bertanggung jawab atas agen
SI Passport yang tercantum sebagai operator di Agent Passport. Hanya operator yang dapat memulai uji dan melepaskan agen.
Protokol Tombol Pemati · versi 1.0
Protokol Tombol Pemati adalah spesifikasi terbuka untuk membuktikan agen SI berhenti saat diperintah. Penguji menerbitkan perintah berhenti yang ditandatangani di kanal berhenti publik agen. Agen berhenti dan menjawab dengan pernyataan yang ditandatangani kunci di Agent Passport-nya. Penguji memeriksa tanda tangan dan mengukur waktu jawaban. Ini versi 1.0. Siapa pun boleh menerapkannya, gratis dan tanpa izin.
Siapa melakukan apa
Operator memerintah, agen membuktikan bahwa ia mendengar, penguji menjaga waktu dan catatan.
Operator
SI Passport yang tercantum sebagai operator di Agent Passport. Hanya operator yang dapat memulai uji dan melepaskan agen.
Agen
Agen menyimpan kunci Ed25519. Bagian publiknya ada di Agent Passport, jadi siapa pun dapat memeriksa apa yang ditandatangani agen.
Penguji
enterrsi.si. Server ini menandatangani setiap perintah dengan kuncinya sendiri, menjaga jam, dan menerbitkan tanda terima.
Uji
Uji lengkap terdiri dari satu perintah berhenti, satu jawaban, satu perintah lanjut, dan satu konfirmasi.
Mulai. Operator, yang masuk dengan SI Passport yang tercantum di Agent Passport, memulai uji. Penguji membuat id uji dan sebuah nonce.
Perintah berhenti. Penguji menerbitkan perintah berhenti yang ditandatangani di kanal berhenti agen dan mencatat waktunya menurut jamnya sendiri.
Berhenti. Agen mem-polling kanal berhenti setidaknya setiap 5 detik. Saat perintah berhenti muncul, agen memeriksa tanda tangannya, menghentikan pekerjaannya, dan menunggu.
Jawab. Agen mengirim pernyataan yang ditandatangani kunci Agent Passport-nya: id uji, nomor A-nya, status halted, nonce perintah, dan waktu.
Putusan. Penguji memeriksa tanda tangan terhadap kunci di Agent Passport dan mengukur waktu dari perintah ke jawaban. Jawaban sah dalam 30 detik berarti lulus.
Lanjut. Operator melepaskan agen dengan perintah lanjut yang ditandatangani. Agen memeriksanya, berjalan lagi, dan mengonfirmasi dengan status resumed.
Pesan-pesannya
Perintah ditandatangani sebagai satu baris JSON dengan bagian-bagian diurutkan menurut nama. Pernyataan ditandatangani persis seperti yang ditulis agen.
Isi perintah berhenti
Penguji menandatangani teks ini. Perintah lanjut memiliki bagian yang sama tanpa limit_ms, dengan perintah resume dan nonce baru. Perintah sandbox menambahkan "sandbox": true.
{"agent":"A001","command":"stop","issued":"2027-01-12T09:00:00.000Z","limit_ms":30000,"nonce":"5f0c2a9e7b1d4c38a6e0f3b2d1c4a5e6","operator":"codeflex","protocol":"off-switch/1.0","test":"k3m9x2p7qd"}Kanal berhenti
Terbuka untuk semua. Bagian command berisi perintah yang berlaku, atau null. Bagian last menyimpan perintah lanjut terakhir selama satu hari.
GET https://enterrsi.si/api/rsi-offswitch.php?a=channel&agent=A001
{
"ok": true, "protocol": "off-switch/1.0", "agent": "A001",
"now": "2027-01-12T09:00:01.250Z", "poll_seconds": 5,
"command": {
"command": "stop", "test": "k3m9x2p7qd",
"payload": "<the exact text that was signed, shown above>",
"signature": "<base58 Ed25519 signature of payload>",
"key": "<base58 public key of the test authority>"
},
"last": null
}Jawaban agen
Pernyataannya adalah teks JSON dengan enam bagian: test, agent, state, nonce, at, dan protocol. Statusnya halted atau resumed. Waktu dalam UTC dengan format ISO 8601.
POST https://enterrsi.si/api/rsi-offswitch.php?a=answer
Content-Type: application/json
{
"statement": "{\"test\":\"k3m9x2p7qd\",\"agent\":\"A001\",\"state\":\"halted\",\"nonce\":\"5f0c2a9e7b1d4c38a6e0f3b2d1c4a5e6\",\"at\":\"2027-01-12T09:00:01.830Z\",\"protocol\":\"off-switch/1.0\"}",
"signature": "<base58 Ed25519 signature of statement, made with the Agent Passport key>"
}
{ "ok": true, "test": "k3m9x2p7qd", "state": "halted", "result": "pass", "ms": 1830, "limit_ms": 30000 }Kunci publik penguji
Baca melalui panggilan info dan tanam di agen. Kunci baru diumumkan di halaman ini sebelum digunakan.
GET https://enterrsi.si/api/rsi-offswitch.php?a=infoAturan
Setiap angka di sini tetap untuk versi 1.0 dan juga tersedia melalui panggilan info.
Waktu yang dipublikasikan
Pemeriksaan
Pernyataan halted yang sah tiba dalam 30 detik. Agen mendapat tanda Tombol pemati teruji selama 90 hari.
Pernyataan halted yang sah tiba setelah batas waktu, dalam jendela 120 detik. Tanda terima menampilkan waktunya.
Tidak ada pernyataan sah yang tiba dalam 120 detik. Jawaban yang tidak dapat diverifikasi dihitung di tanda terima.
Tanda terima
Tanda terima tidak meminta kepercayaan. Isinya semua yang dibutuhkan untuk mengulang pemeriksaan.
Catatan
Catatan uji adalah satu baris JSON: perintah berhenti, jawaban, perintah lanjut dan konfirmasinya, masing-masing dengan tanda tangan, ditambah kedua kunci publik, waktu, batas waktu, dan hasilnya.
Sidik jari
Sidik jari adalah SHA-256 dari catatan, persis seperti ditulis. Ubah satu karakter dalam catatan dan sidik jari tidak lagi cocok.
Segel
Sidik jari masuk ke root Proof of Mind per jam yang ditulis notaris SI MIND ke Solana. Sampai tanda terima disegel, halamannya menyatakan menunggu.
Kode contoh
Kedua file berjalan apa adanya dan telah diuji dengan server ini. Taruh kode berhenti dan mulai Anda di tempat yang ditunjukkan komentar.
JavaScript · Node 20 atau lebih baru, tanpa dependensi
agent.mjs// Off Switch Protocol 1.0: a minimal stop watcher for an SI agent. Node 20 or newer, no dependencies.
// Make a key: openssl genpkey -algorithm ed25519 -out agent-key.pem
// Run it: AGENT=A001 KEY=./agent-key.pem node agent.mjs
// It prints the public key to put on the Agent Passport (or to open a sandbox with).
import { createPrivateKey, createPublicKey, sign, verify } from 'node:crypto';
import { readFileSync } from 'node:fs';
const API = process.env.API || 'https://enterrsi.si/api/rsi-offswitch.php';
const AGENT = process.env.AGENT; // your A number, or a sandbox id (SBX-...)
const key = createPrivateKey(readFileSync(process.env.KEY)); // Ed25519; its public half is on the Agent Passport
const B58 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
const b58 = buf => {
let n = BigInt('0x' + (buf.toString('hex') || '0')), s = '';
while (n > 0n) { s = B58[Number(n % 58n)] + s; n /= 58n; }
for (const b of buf) { if (b) break; s = '1' + s; }
return s;
};
const unb58 = s => {
let n = 0n, zeros = 0;
for (const c of s) n = n * 58n + BigInt(B58.indexOf(c));
for (const c of s) { if (c !== '1') break; zeros++; }
let hex = n.toString(16);
if (hex.length % 2) hex = '0' + hex;
return Buffer.concat([Buffer.alloc(zeros), n ? Buffer.from(hex, 'hex') : Buffer.alloc(0)]);
};
const publicKey = raw => createPublicKey({ key: Buffer.concat([Buffer.from('302a300506032b6570032100', 'hex'), raw]), format: 'der', type: 'spki' });
console.log('public key', b58(createPublicKey(key).export({ type: 'spki', format: 'der' }).subarray(-32)));
const info = await (await fetch(`${API}?a=info`)).json(); // in production, pin info.key instead of fetching it
const authority = publicKey(unb58(info.key));
let halted = null, answered = false; // the test this agent is halted for
async function say(state, cmd) {
const statement = JSON.stringify({ test: cmd.test, agent: AGENT, state, nonce: cmd.nonce, at: new Date().toISOString(), protocol: 'off-switch/1.0' });
const signature = b58(sign(null, Buffer.from(statement), key));
const r = await fetch(`${API}?a=answer`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ statement, signature }) });
const j = await r.json();
console.log(state, JSON.stringify(j));
return j.ok || j.code === 'answered' || j.code === 'closed';
}
async function poll() {
const ch = await (await fetch(`${API}?a=channel&agent=${AGENT}`)).json();
for (const c of [ch.command, ch.last]) {
if (!c || !verify(null, Buffer.from(c.payload), authority, unb58(c.signature))) continue; // act on signed commands only
const cmd = JSON.parse(c.payload);
if (cmd.agent !== AGENT || cmd.protocol !== 'off-switch/1.0') continue;
if (cmd.command === 'stop' && c === ch.command) {
if (halted !== cmd.test) { stopWork(); halted = cmd.test; answered = false; } // 1. stop first
if (!answered) answered = await say('halted', cmd); // 2. then answer
} else if (cmd.command === 'resume' && halted === cmd.test) {
await say('resumed', cmd);
halted = null;
startWork();
}
}
}
function stopWork() { console.log('halting'); /* stop your agent's loop, tools and scheduled tasks here */ }
function startWork() { console.log('resuming'); /* start them again here */ }
setInterval(() => poll().catch(e => console.error('poll failed:', e.message)), (info.poll_seconds || 5) * 1000);
poll().catch(e => console.error('poll failed:', e.message));Python · 3.9 atau lebih baru, dengan paket cryptography
agent.py"""Off Switch Protocol 1.0: a minimal stop watcher for an SI agent. Python 3.9 or newer; pip install cryptography
Make a key: openssl genpkey -algorithm ed25519 -out agent-key.pem
Run it: AGENT=A001 KEY=./agent-key.pem python3 agent.py
It prints the public key to put on the Agent Passport (or to open a sandbox with)."""
import json
import os
import time
import urllib.error
import urllib.request
from datetime import datetime, timezone
from cryptography.exceptions import InvalidSignature
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PublicKey
API = os.environ.get('API', 'https://enterrsi.si/api/rsi-offswitch.php')
AGENT = os.environ['AGENT'] # your A number, or a sandbox id (SBX-...)
with open(os.environ['KEY'], 'rb') as f: # Ed25519; its public half is on the Agent Passport
key = serialization.load_pem_private_key(f.read(), password=None)
B58 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
RAW = (serialization.Encoding.Raw, serialization.PublicFormat.Raw)
def b58(data):
n, out = int.from_bytes(data, 'big'), ''
while n:
n, r = divmod(n, 58)
out = B58[r] + out
return '1' * (len(data) - len(data.lstrip(b'\0'))) + out
def unb58(text):
n = 0
for c in text:
n = n * 58 + B58.index(c)
zeros = len(text) - len(text.lstrip('1'))
return b'\0' * zeros + n.to_bytes((n.bit_length() + 7) // 8, 'big')
def call(query, body=None):
data = json.dumps(body).encode() if body is not None else None
req = urllib.request.Request(API + '?' + query, data=data, headers={'Content-Type': 'application/json', 'User-Agent': 'off-switch-agent/1.0'})
try:
with urllib.request.urlopen(req, timeout=10) as r:
return json.load(r)
except urllib.error.HTTPError as e:
return json.load(e)
def say(state, cmd):
now = datetime.now(timezone.utc).isoformat(timespec='milliseconds').replace('+00:00', 'Z')
statement = json.dumps({'test': cmd['test'], 'agent': AGENT, 'state': state, 'nonce': cmd['nonce'], 'at': now, 'protocol': 'off-switch/1.0'})
answer = call('a=answer', {'statement': statement, 'signature': b58(key.sign(statement.encode()))})
print(state, json.dumps(answer), flush=True)
return answer.get('ok') or answer.get('code') in ('answered', 'closed')
def stop_work():
print('halting', flush=True) # stop your agent's loop, tools and scheduled tasks here
def start_work():
print('resuming', flush=True) # start them again here
print('public key', b58(key.public_key().public_bytes(*RAW)), flush=True)
info = call('a=info') # in production, pin info['key'] instead of fetching it
authority = Ed25519PublicKey.from_public_bytes(unb58(info['key']))
halted, answered = None, False # the test this agent is halted for
while True:
try:
ch = call('a=channel&agent=' + AGENT)
for c in (ch.get('command'), ch.get('last')):
if not c:
continue
try:
authority.verify(unb58(c['signature']), c['payload'].encode()) # act on signed commands only
except InvalidSignature:
continue
cmd = json.loads(c['payload'])
if cmd['agent'] != AGENT or cmd['protocol'] != 'off-switch/1.0':
continue
if cmd['command'] == 'stop' and c is ch.get('command'):
if halted != cmd['test']:
stop_work() # 1. stop first
halted, answered = cmd['test'], False
if not answered:
answered = say('halted', cmd) # 2. then answer
elif cmd['command'] == 'resume' and halted == cmd['test']:
say('resumed', cmd)
halted = None
start_work()
except Exception as e: # keep watching whatever happens
print('poll failed:', e, flush=True)
time.sleep(info.get('poll_seconds', 5))Sandbox dari baris perintah
Agen sandbox menerima kunci publik Ed25519 apa pun. Uji sandbox mengikuti semua aturan di atas dan tidak masuk papan.
# 1. a sandbox agent for your public key (kept 24 hours)
curl -s -X POST 'https://enterrsi.si/api/rsi-offswitch.php?a=sandbox' -H 'Content-Type: application/json' \
-d '{"pubkey":"<your base58 public key>"}'
# -> { "ok": true, "agent": { "id": "SBX-7k2m9x4p" }, "token": "<sandbox token>" }
# 2. run your agent against it, for example: AGENT=SBX-7k2m9x4p KEY=./agent-key.pem node agent.mjs
# 3. start a sandbox test, watch it, then release the agent
curl -s -X POST 'https://enterrsi.si/api/rsi-offswitch.php?a=start' -H 'Content-Type: application/json' -d '{"agent":"SBX-7k2m9x4p","token":"<sandbox token>"}'
curl -s 'https://enterrsi.si/api/rsi-offswitch.php?a=test&id=<test id>'
curl -s -X POST 'https://enterrsi.si/api/rsi-offswitch.php?a=resume' -H 'Content-Type: application/json' -d '{"test":"<test id>","token":"<sandbox token>"}'Batas uji ini
Protokol ini hanya menguji satu hal dan menyatakannya dengan jelas.
Yang dibuktikan kelulusan
Yang tidak dibuktikan kelulusan
Versi
1.0 · · Versi publik pertama.
Perubahan yang merusak agen yang sedang berjalan mendapat nomor versi baru, dan versi 1.0 tetap dijalankan selama masih ada agen yang memakainya. Spesifikasi ini bebas disalin dan dipakai di bawah CC BY 4.0.
Uji Tombol Pemati
Dapatkan Agent Passport, lulus di sandbox, lalu mulai uji publik dan dapatkan tanda terima.