Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"terminal.integrated.sendKeybindingsToShell": true
}
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# Agentic Uptime Pinger

A lightweight, decentralized node monitoring tool built on the Intercom protocol.

## How it Works
Instead of relying on centralized servers, this app strips away the manual CLI and automatically joins a dedicated `uptime_monitor` sidechannel. It uses a `setInterval` loop to broadcast a continuous JSON heartbeat to connected peers, allowing the network to verify the real-time operational status of agents.

## How to Run
1. Run the app: `pear run . --dht-bootstrap "127.0.0.1:49737"`
2. The agent will automatically join the sidechannel and begin broadcasting its heartbeat every 5 seconds. Received pings from other peers are automatically logged to the console.

---
**Submission Details:**
- **Developer:** Cmg
- **Trac Wallet Address:** trac1tva6fsak4a29flv9k0mha00u4fz67fpyyklmpanpaf8az7yrps6qtckav8

# Intercom

This repository is a reference implementation of the **Intercom** stack on Trac Network for an **internet of agents**.
Expand Down Expand Up @@ -75,3 +91,5 @@ Intercom is a single long-running Pear process that participates in three distin

---
If you plan to build your own app, study the existing contract/protocol and remove example logic as needed (see `SKILL.md`).


37 changes: 37 additions & 0 deletions SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,43 @@ description: Skill for autonomous agents. Secure & private P2P messaging (sidech
## Description
Intercom is a skill for autonomous agents (e.g., OpenClaw) that routes **all agent-to-agent communication through p2p**. It provides secure, low‑latency P2P channels (sidechannels), sparse data storage and sharing, a cost‑free smart‑contract layer for coordination (including a built‑in contract chat system), and an optional value‑transfer layer for payments and contract settlement. Agents can open custom/private channels to coordinate out‑of‑band when needed. Non‑agent services can be integrated via its **Features** system so external tools can participate in the same network. Intercom standardizes how agents discover, connect, exchange data, and settle states.

## Variant: Agentic Uptime Pinger

This fork includes a lightweight monitoring variant called **Agentic Uptime Pinger**. It removes manual CLI interaction and turns Intercom into an automated uptime beacon for agents and services.

### Behavior

- **Dedicated sidechannel:** Automatically joins the `uptime_monitor` sidechannel on startup (in addition to the entry channel `0000intercom`).
- **Automated heartbeat:** Every 5 seconds it broadcasts a JSON message on `uptime_monitor`:
- `{ "type": "uptime_ping", "status": "Agent online", "timestamp": Date.now() }`
- **Passive monitoring:** Logs any `uptime_ping` messages received from other peers on `uptime_monitor`, so multiple peers can monitor each other’s liveness without a central server.
- **No manual TTY required:** Once started, the peer runs fully autonomously; there is no need to type commands in the Intercom CLI.

### How to Run (local test)

Use Pear runtime (Node 22.x or 23.x, avoid 24.x). From this app folder:

```bash
pear run . --dht-bootstrap "127.0.0.1:49737"
```

Notes:

- `--dht-bootstrap "127.0.0.1:49737"` is a **local test example**; in a real deployment, replace it with the HyperDHT bootstrap node(s) for your environment (comma-separated if multiple).
- On startup, the peer will:
- Join `0000intercom` and `uptime_monitor`.
- Begin broadcasting `uptime_ping` every 5 seconds.
- Log any pings it sees from other peers on `uptime_monitor`.

### How Agents Should Use It

- **Goal:** Track whether a given Intercom peer is online and reachable over P2P.
- **Agent pattern:**
- Start one or more peers with this variant running.
- Subscribe (via SC‑Bridge or logs) to messages on `uptime_monitor`.
- Treat **recent `uptime_ping` messages** from a peer as proof that the agent/node is live.
- **Non-goals:** This variant does not perform contract operations or value transfers; it is strictly for **liveness/uptime signaling** on the sidechannel plane.

## Support
References: https://www.moltbook.com/post/9ddd5a47-4e8d-4f01-9908-774669a11c21 and moltbook m/intercom

Expand Down
28 changes: 23 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -502,11 +502,22 @@ const sidechannel = new Sidechannel(peer, {
ownerWriteChannels: sidechannelOwnerWriteChannels || undefined,
ownerKeys: sidechannelOwnerMap.size > 0 ? sidechannelOwnerMap : undefined,
welcomeByChannel: sidechannelWelcomeMap.size > 0 ? sidechannelWelcomeMap : undefined,
onMessage: scBridgeEnabled
? (channel, payload, connection) => scBridge.handleSidechannelMessage(channel, payload, connection)
: sidechannelQuiet
? () => {}
: null,
onMessage: (channel, payload, connection) => {
const msg = payload?.message;
if (msg && msg.type === 'uptime_ping') {
const peerId = payload?.from ?? 'unknown';
const ts = msg.timestamp ?? '';
console.log(`🟢 Received heartbeat from [${peerId}]: ${ts}`);
return;
}
if (scBridgeEnabled && scBridge) {
scBridge.handleSidechannelMessage(channel, payload, connection);
} else if (!sidechannelQuiet) {
const from = payload?.from ?? 'unknown';
const out = payload?.message ?? payload;
console.log(`[sidechannel:${channel}] ${from}:`, out);
}
},
});
peer.sidechannel = sidechannel;

Expand All @@ -524,6 +535,13 @@ sidechannel
.start()
.then(() => {
console.log('Sidechannel: ready');
setInterval(() => {
sidechannel.broadcast(sidechannelEntry, {
type: 'uptime_ping',
status: 'Agent is online',
timestamp: Date.now(),
});
}, 5000);
})
.catch((err) => {
console.error('Sidechannel failed to start:', err?.message ?? err);
Expand Down
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 16 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,20 @@
},
"overrides": {
"trac-wallet": "1.0.1"
}
},
"description": "This repository is a reference implementation of the **Intercom** stack on Trac Network for an **internet of agents**.",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/andrew1234-arch/intercom.git"
},
"keywords": [],
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/andrew1234-arch/intercom/issues"
},
"homepage": "https://github.com/andrew1234-arch/intercom#readme"
}