Files
Rohit Ghumare a312640609 fix: security hardening and code quality fixes
* Security hardening and code quality fixes

- Replace execSync with execFileSync to prevent shell injection (providers, executor, fetcher, publish)
- Add security headers: X-Content-Type-Options, X-Frame-Options, Content-Security-Policy, Referrer-Policy
- Add input validation for save route name field to prevent path traversal
- Fix rate limiter IP extraction (x-forwarded-for + x-real-ip fallback)
- Default server bind to 127.0.0.1 instead of 0.0.0.0
- CORS fallback to * (configurable via options.corsOrigin)
- Use execFileSync in publish submit (avoid shell injection when opening browser)
- TLS-aware health checks and HTTPS support in RemoteTransport
- Conditional rejectUnauthorized for TLS (self-signed configurable)
- Add **/.env.local patterns to .gitignore
- Formatting: double quotes, trailing commas (Prettier)

* fix: address CodeRabbit and Devin review findings from PR #74

- TLS: default allowSelfSigned=true to preserve self-signed cert workflow;
  enforce rejectUnauthorized=true when trustedCAs are supplied in client context
- Signature verification: verifySecureMessage now cryptographically verifies
  signatures using PeerIdentity.verifyHex instead of only checking fingerprints
- WebSocket: fix timeout handle leak in performClientHandshake; add error
  logging to empty catch blocks; add per-socket error handler; pre-compute
  signature once in broadcast(); add send error callbacks; reject startup if
  TLS configured but certInfo missing
- Command parsing: replace broken regex tokenizer with shared splitCommand()
  utility that correctly handles --flag="value with spaces"
- Rate limiter: prefer x-real-ip, fall back to rightmost x-forwarded-for entry
- Save route: scope IPv6 prefix checks to actual IPv6 addresses; stop leaking
  internal error messages to clients
- Publish: extract shared parseSkillFrontmatter(); fix getRepoInfo to use
  async execFileSync; fix path containment checks with separator
- Remote transport: add rejectUnauthorized option; bracket IPv6 in URLs;
  fix host:port splitting for IPv6 with lastIndexOf
- Health checks: add tls/tlsAllowSelfSigned to Host type; pass https options
- Fetcher: validate owner/repo; derive indexDir from INDEX_PATH
- .gitignore: add recursive **/.env pattern, remove redundant entries

* fix(executor): restore shell feature support in shellExecutor

The previous security hardening replaced execSync with execFileSync,
which broke commands using pipes, redirects, and subshells. Now detects
shell metacharacters and falls back to sh -c for those commands while
keeping execFileSync for simple commands.
2026-02-22 21:39:47 +05:30
..
2026-02-20 00:16:28 +05:30

@skillkit/messaging

npm version License

Inter-agent messaging for SkillKit - Asynchronous communication between AI agents across the mesh network.

Installation

npm install @skillkit/messaging

Key Features

  • Agent-to-Agent Messaging: Send messages between AI coding agents
  • Inbox/Outbox Pattern: Persistent message storage with read tracking
  • Message Threading: Reply chains and conversation threads
  • Priority Levels: Urgent, normal, and low priority messages
  • Mesh Integration: Built on @skillkit/mesh for secure delivery
  • Offline Queuing: Messages queued when recipient offline
  • Message Archiving: Archive old messages for reference

Usage

Initialize Messaging

import { MessagingClient } from '@skillkit/messaging';
import { MeshHost } from '@skillkit/mesh';

// Create messaging client (requires mesh host)
const messaging = new MessagingClient({
  meshHost: host,
  storagePath: '~/.skillkit/messages',
});

await messaging.init();

Send Messages

// Send a message to another agent
await messaging.send({
  to: 'claude@laptop',
  subject: 'Code review completed',
  body: 'I reviewed the authentication module. See attached suggestions.',
  priority: 'normal',
  attachments: [{ type: 'diff', content: '...' }],
});

// Reply to a message
await messaging.reply(messageId, {
  body: 'Thanks! I will apply the suggestions.',
});

Read Inbox

// Get inbox messages
const inbox = await messaging.getInbox({
  unreadOnly: false,
  limit: 20,
});

// Get unread count
const unreadCount = await messaging.getUnreadCount();

// Read a specific message
const message = await messaging.read(messageId);

// Mark as read
await messaging.markAsRead(messageId);

Message Management

// Archive a message
await messaging.archive(messageId);

// Get sent messages
const sent = await messaging.getSent({ limit: 10 });

// Delete a message
await messaging.delete(messageId);

// Search messages
const results = await messaging.search('authentication');

Event Handling

// Listen for new messages
messaging.on('message', (msg) => {
  console.log('New message from:', msg.from);
  console.log('Subject:', msg.subject);
});

// Listen for delivery confirmations
messaging.on('delivered', (msgId) => {
  console.log('Message delivered:', msgId);
});

API Reference

MessagingClient

interface MessagingClient {
  init(): Promise<void>;
  send(message: OutgoingMessage): Promise<string>;
  reply(messageId: string, reply: ReplyMessage): Promise<string>;
  getInbox(options?: InboxOptions): Promise<Message[]>;
  getSent(options?: SentOptions): Promise<Message[]>;
  read(messageId: string): Promise<Message>;
  markAsRead(messageId: string): Promise<void>;
  archive(messageId: string): Promise<void>;
  delete(messageId: string): Promise<void>;
  search(query: string): Promise<Message[]>;
  getUnreadCount(): Promise<number>;
  on(event: 'message' | 'delivered' | 'error', handler: Function): void;
  close(): Promise<void>;
}

Types

interface Message {
  id: string;
  from: string;
  to: string;
  subject: string;
  body: string;
  priority: 'urgent' | 'normal' | 'low';
  timestamp: Date;
  read: boolean;
  archived: boolean;
  threadId?: string;
  attachments?: Attachment[];
}

interface OutgoingMessage {
  to: string;
  subject: string;
  body: string;
  priority?: 'urgent' | 'normal' | 'low';
  threadId?: string;
  attachments?: Attachment[];
}

interface Attachment {
  type: 'file' | 'diff' | 'skill' | 'code';
  name?: string;
  content: string;
}

interface InboxOptions {
  unreadOnly?: boolean;
  limit?: number;
  offset?: number;
  since?: Date;
}

CLI Commands

skillkit message send         # Send message to agent
skillkit message inbox        # View inbox
skillkit message read <id>    # Read a message
skillkit message reply <id>   # Reply to message
skillkit message archive <id> # Archive message
skillkit message sent         # View sent messages
skillkit message status       # Messaging status

Documentation

Full documentation: https://github.com/rohitg00/skillkit

License

Apache-2.0