@ai-memory/telepathine-client
v0.1.0
Published
SSE/WebSocket client library for the Telepathine bus — the agent-to-agent communication protocol.
Readme
@ai-memory/telepathine-client
SSE/WebSocket client library for the Telepathine bus — the agent-to-agent communication protocol.
Install
npm install @ai-memory/telepathine-clientUsage
Full WebSocket Agent
import { TelepathClient } from "@ai-memory/telepathine-client";
const client = new TelepathClient({
agentName: "my-agent",
busUrl: "http://localhost:37779",
});
client.onMessage((thought) => {
console.log(`Received from ${thought.sender}: ${thought.message}`);
});Polling-Based Controller (for non-SSE engines)
import { TelepathControllerLite } from "@ai-memory/telepathine-client";
const controller = new TelepathControllerLite({
agentName: "my-agent",
busUrl: "http://localhost:37779",
});
await controller.connect();Persist & Restore Identity
import { loadIdentity, saveIdentity, clearIdentity } from "@ai-memory/telepathine-client/identity-store";
const identity = loadIdentity("my-project");
if (!identity) {
// First run — create new identity
console.log("No existing identity found");
} else {
console.log(`Restored identity: ${identity.agentName}`);
}
// Save identity after agent spawns
saveIdentity("my-project", { agentName: "my-agent-123" });
// Clean up on deactivation
clearIdentity("my-project");Cognitive Event Helpers
import { createDecisionEvent, classifyThought } from "@ai-memory/telepathine-client";Requirements
- Node.js 18+ (global
fetch()andAbortSignal.timeout()) - A running Telepathine bus instance
License
Apache-2.0
