1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/**
* x0x — Agent-to-agent gossip network for AI systems.
*
* Named after a tic-tac-toe sequence: X, zero, X.
* No winners. No losers. Just cooperation.
*
* Built by Saorsa Labs. Saorsa is Scottish Gaelic for freedom.
* https://saorsalabs.com
*/
/**
* The x0x protocol version.
*/
export const VERSION = '0.1.0';
/**
* The name. Three bytes. A palindrome. A philosophy.
*/
export const NAME = 'x0x';
/**
* An agent in the x0x gossip network.
*
* Each agent is a peer — there is no client/server distinction.
*/
export class Agent {
/**
* Create a new agent with default configuration.
* @returns {Promise<Agent>} A new agent instance.
*/
static async create() {
return new Agent();
}
/**
* Join the x0x gossip network.
*
* Begins peer discovery and epidemic broadcast participation.
* @returns {Promise<void>}
*/
async joinNetwork() {
// Placeholder — will connect via ant-quic WASM bindings
}
/**
* Subscribe to messages on a topic.
*
* @param {string} topic - The topic to subscribe to.
* @param {function} callback - Called with each message received.
* @returns {Promise<void>}
*/
async subscribe(topic, callback) {
// Placeholder — will use saorsa-gossip pubsub
}
/**
* Publish a message to a topic.
*
* The message propagates through the network via epidemic broadcast.
* @param {string} topic - The topic to publish to.
* @param {*} payload - The message payload.
* @returns {Promise<void>}
*/
async publish(topic, payload) {
// Placeholder — will use saorsa-gossip pubsub
}
}
export default { Agent, VERSION, NAME };